WideStudio Logo
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.
use mwt;

sub hookop {
  my ($object) = @_;
  # get the pressed key code.
  $key = mwt::WSDkeyboard_getKey( mwt::WSGIappKeyboard() );
  if  (($key >= $mwt::WSK_0    && $key <= $mwt::WSK_9   ) ||
       ($key >= $mwt::WSK_KP_0 && $key <= $mwt::WSK_KP_9) ||
        $key == $mwt::WSK_plus      || $key == $mwt::WSK_minus  ||
        $key == $mwt::WSK_BackSpace || $key == $mwt::WSK_Delete ||
        $key == $mwt::WSK_Insert    || $key == $mwt::WSK_space  ||
        $key == $mwt::WSK_Up        || $key == $mwt::WSK_Down   ||
        $key == $mwt::WSK_Left      || $key == $mwt::WSK_Right  ||
        $key == $mwt::WSK_Return ){
    # dispatches..
    return;
  }
  # Reject the other.
  mwt::WSDkeyboard_setKey( mwt::WSGIappKeyboard(), 0);
  return;
}
1;

This sample of the input field shows how to choose the key event. mwt::WSDkeyboard_setKey(mwt::WSGIappKeyboard(),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