WideStudio Logo
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..
  # Reject the other.

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.80 for WideStudio ver 3.80, Jan 2005

WideStudio documents index | Table of contents

Copyright(C) WideStudio Development Team, 1999-2005 Last modified: Jan 05, 2005