![]() | 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. ... public class hookop { protected static void hookop(WSCbase object){ // get the pressed key code. long 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; } // Reject the other. Mpfc.WSGIappKeyboard().setKey(0); } }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.
Copyright(C) WideStudio Development Team, 1999-2005 | Last modified: Jan 05, 2005 |