WideStudio Logo
WideStudio
Programming Guide
WideStudio Index
Table of contents


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

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

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

def hookop(object):
  # 어떤 처리를 쓰십시오
  key = mpfc.WSGIappKeyboard().getKey();
  if  ((key >= mpfc.WSK_0    and key <= mpfc.WSK_9   ) or
       (key >= mpfc.WSK_KP_0 and key <= mpfc.WSK_KP_9) or
        key == mpfc.WSK_plus      or key == mpfc.WSK_minus  or
        key == mpfc.WSK_BackSpace or key == mpfc.WSK_Delete or key == mpfc.WSK_Insert or
        key == mpfc.WSK_space     or key == mpfc.WSK_Up     or key == mpfc.WSK_Down   or
        key == mpfc.WSK_Left      or key == mpfc.WSK_Right  or key == mpfc.WSK_Return ):
    # 숫자 키는 처리를 통과한다
    return;
  # 그외는 버린다
  mpfc.WSGIappKeyboard().setKey(0);
  return
mpfc.WSGFfunctionRegister("hookop",hookop)

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

Document Release 3.70 for WideStudio ver 3.70, May 2004


WideStudio documents index | Table of contents

Copyright(C) WideStudio Development Team, 1999-2004 Last modified: May 25, 2004