WideStudio Programming Guide

| WideStudio Programming Guide | WideStudio Index Table of contents

> ## How to select the key events on the input field

> You can select or reject/convert the key events on the input field with the event procedure by the WSEV_KEY_HOOK trigger.

>     # A WSEV_KEY_HOOK sample procedure.
>     # Set the input field with the WSEV_KEY_HOOK trigger.
>     ...

>     def hookop(object)
>       # get the pressed key code.
>       key = Mpfc::WSGIappKeyboard().getKey()
>       if  (key >= Mpfc::WSK_0    && key <= Mpfc::WSK_9   ) ||
>            (key >= Mpfc::WSK_KP_0 && key <= Mpfc::WSK_KP_9) ||
>             key == Mpfc::WSK_plus      || key == Mpfc::WSK_minus  ||
>             key == Mpfc::WSK_BackSpace || key == Mpfc::WSK_Delete || key == Mpfc::WSK_Insert ||
>             key == Mpfc::WSK_space     || key == Mpfc::WSK_Up     || key == Mpfc::WSK_Down   ||
>             key == Mpfc::WSK_Left      || key == Mpfc::WSK_Right  || key == Mpfc::WSK_Return ))
>         # dispatches..
>         return
>       end
>       # Reject the other.
>       Mpfc::WSGIappKeyboard().setKey(0)
>     end

> This sample of the input field shows how to choose the key event. Mpfc::WSGIappKeyboard().setKey(0) reject the key event which you do not need.

Document Release 3.70 for WideStudio ver 3.70, Feb 2004

WideStudio documents index | Table of contents

Copyright(C) T. Hirabayashi, 2000-2004 | Last modified: Feb 25, 2004