![]() | 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 = mwt.WSGIappKeyboard().getKey(); if ((key >= mwt.WSK_0 and key <= mwt.WSK_9 ) or (key >= mwt.WSK_KP_0 and key <= mwt.WSK_KP_9) or key == mwt.WSK_plus or key == mwt.WSK_minus or key == mwt.WSK_BackSpace or key == mwt.WSK_Delete or key == mwt.WSK_Insert or key == mwt.WSK_space or key == mwt.WSK_Up or key == mwt.WSK_Down or key == mwt.WSK_Left or key == mwt.WSK_Right or key == mwt.WSK_Return ): # dispatches.. return; # Reject the other. mwt.WSGIappKeyboard().setKey(0); return mwt.WSGFfunctionRegister("hookop",hookop)This sample of the input field shows how to choose the key event. mwt.WSGIappKeyboard().setKey(0) reject the key event which you do not need.
Copyright(C) WideStudio Development Team, 1999-2005 | Last modified: Jan 05, 2005 |