![]() | 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. use mpfc; sub hookop { my ($object) = @_; # get the pressed key code. $key = mpfc::WSDkeyboard_getKey( mpfc::WSGIappKeyboard() ); 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::WSDkeyboard_setKey( mpfc::WSGIappKeyboard(), 0); return; } 1;This sample of the input field shows how to choose the key event. mpfc::WSDkeyboard_setKey(mpfc::WSGIappKeyboard(),0) reject the key event which you do not need.
Copyright(C) WideStudio Development Team, 1999-2005 | Last modified: Jan 05, 2005 |