WideStudio/MWT Logo
WideStudio/MWT
Programming Guide
WideStudio/MWT Index
Table of contents


입력 필드에서 키 입력을 선별하기에는

입력 필드에서 키 입력을 선별하기에는 키 훅(hook) 트리거(trigger)로 이벤트 프로시저를 작성합니다.

(* 키 훅(hook)의 이벤트 프로시저의 샘플          *)
(* WSEV_KEY_HOOK 트리거(trigger)로 설정합니다.   *)
...

let hookop obj =
  (* 어떤 처리를 쓰십시오 *)
  let key = get_int (_WSGIappKeyboard '() -> getKey () ) in
  if (((key >= get_int _WSK_0) && ( key < get_int _WSK_9)) ||
     ((key >= get_int _WSK_KP_0) && ( key < get_int _WSK_KP_9)) ||
     (key = get_int _WSK_plus)  || (key = get_int _WSK_minus) ||
     (key = get_int _WSK_BackSpace) || (key = get_int _WSK_Delete) || (key = get_int _WSK_Insert) ||
     (key = get_int _WSK_space) || (key = get_int _WSK_Up) || (key = get_int _WSK_Down) ||
     (key = get_int _WSK_Left) || (key = get_int _WSK_Right) || (key = get_int _WSK_Return) ) then begin
    (* 숫자 키는 처리를 통과한다 *)
  end else begin
    (* 그외는 버린다 *)
    ignore(_WSGIappKeyboard '() -> setKey (0));
  end
  ()

let _ = Callback.register "hookop" hookop

이 샘플은 숫자 입력만을 실행할 입력 필드를 실현합니다. 자판 객체에 대해서 getKey() 함수에의하여 현재 입력되여있는 키를 선별하여 필요없는 키인 경우 _WSGIappKeyboard '()->setKey(0) 를 실행해서 입력 키 코드를 치워서 입력이 없었던것처럼 행동합니다.

Document Release 3.90 for WideStudio/MWT ver 3.90, Jul 2005


WideStudio/MWT documents index | Table of contents

Copyright(C) WideStudio/MWT Development Team, 1999-2005 Last modified: Jul 31, 2005