完全模仿了1个text控件,只能输入 数字和 + . -
* text1.init
this.value = ""
* text1.kepress
LPARAMETERS nKeyCode, nShiftAltCtrl
IF INLIST(nKeyCode,48,49,50,51,52,53,54,55,56,57,5,19,24,4,7,127,45,43,13,46,1,6)
IF This.SelStart=0 AND (OCCURS("+",This.Value) >0 OR OCCURS("-",This.Value) >0) AND !INLIST(nKeyCode,5,19,24,4,7,127,13,1,6) &&有+/-时,不能在第1位输入任何字符
NODEFAULT
ENDIF
IF nKeyCode=46 AND OCCURS(".",This.Value)>0 &&只能输入1个小数点
NODEFAULT
ENDIF
IF (nKeyCode=43 OR nKeyCode=45) AND (OCCURS("+",This.Value) >0 OR OCCURS("-",This.Value) >0) &&只能输入1个+/-
NODEFAULT
ENDIF
IF nKeyCode=43 AND (This.SelStart > 0 OR OCCURS("+",This.Value) >0) &&只能在首位输入+,只能输入1个
NODEFAULT
ENDIF
IF nKeyCode=45 AND (This.SelStart > 0 OR OCCURS("-",This.Value) >0) &&只能在首位输入-,只能输入1个
NODEFAULT
ENDIF
ELSE
NODEFAULT
ENDIF
[此贴子已经被作者于2018-3-7 17:17编辑过]