| 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    and key <= mpfc.WSK_9   ) or
>            (key >= mpfc.WSK_KP_0 and key <= mpfc.WSK_KP_9) or
>             key == mpfc.WSK_plus      or key == mpfc.WSK_minus  or
>             key == mpfc.WSK_BackSpace or key == mpfc.WSK_Delete or key == mpfc.WSK_Insert or
>             key == mpfc.WSK_space     or key == mpfc.WSK_Up     or key == mpfc.WSK_Down   or
>             key == mpfc.WSK_Left      or key == mpfc.WSK_Right  or key == mpfc.WSK_Return ):
>         # dispatches..
>         return;
>       # Reject the other.
>       mpfc.WSGIappKeyboard().setKey(0);
>       return
>     mpfc.WSGFfunctionRegister("hookop",hookop)

> 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, May 2004

WideStudio documents index | Table of contents

Copyright(C) WideStudio Development Team, 1999-2004 | Last modified: May 25, 2004