As many of you already know, $ES_NUMBER can not entirely prevent "non number characters" to be inserted to the input control (here is my report about this issue), and this why i needed to make an UDF that will help to solve this issue.
Here the example of usage:
#include <GuiConstants.au3> #include <GUIInputSetOnlyNumbers.au3> $GUI = GUICreate("_GUIInputSetOnlyNumbers() Demo", 400, 100) $Input_1 = GUICtrlCreateInput("", 20, 10, 360, 20) _GuiInputSetOnlyNumbers($Input_1) $Input_2 = GUICtrlCreateInput("", 20, 40, 360, 20) _GuiInputSetOnlyNumbers($Input_2) $Exit = GUICtrlCreateButton("Exit", 20, 70, 60, 20) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $Exit ExitLoop EndSwitch WEnd
The UDF itself + this example attached in this archive:
GUIInputSetOnlyNumbers.zip 1.45KB
225 downloadsEdit 1:
GUIInputSetOnlyNumbers.zip 1.46KB
275 downloads* Fixed the tooltip text data (thanks to JustinReno).
Edit 2:
GUIInputSetOnlyNumbers.zip 1.5KB
533 downloads* Now unacceptable characters wil not be shown at all (EN_CHANGE replaced with EN_UPDATE - thanks to Siao).
* Now the tooltip displayed more correctly (the edges of the parent window is now "taken in count").
* The ToolTip now will be shown always (even if the edges of input control are outside of screen borders).
Enjoy!
Edited by MsCreatoR, 12 November 2007 - 05:32 PM.







