#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#Region ### START Koda GUI section ### Form=c:\documents and settings\administrator\my documents\form1.kxf
$Form1 = GUICreate("test", 409, 260, 434, 170)
$Label1 = GUICtrlCreateLabel("X:", 40, 32, 86, 17)
$Input1 = GUICtrlCreateInput("", 120, 32, 121, 21);, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER))
GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam)
Local Const $EN_CHANGE = 0x300
Local $nNotifyCode = BitShift($wParam, 16)
Local $nID = BitAND($wParam, 0xFFFF)
Local $hCtrl = $lParam
If $nNotifyCode = $EN_CHANGE Then
if StringRegExp(GUICtrlRead($Input1),'[^\d]+',0) then
GUICtrlSetData($Input1,StringRegExpReplace(GUICtrlRead($Input1),'[^\d]+',''))
ToolTip("error")
EndIf
EndIf
EndFunc ;==>MY_WM_COMMAND
|