Pal, Peter's AutoIt Library Pal Wiki
Library for window, GUI, controls, string, math, data lists, dialogues
Brought to you by:
peverbeek
AutoIt file: NumberBox.au3
A numberbox control limits the user input to numbers you have set it to (GUICtrlCreateInput() function). A few examples:
_GUICtrlNumberBox_Create("999", 7, 0, 0, 100, 25)
GUICtrlSetTip(-1, "Format 999: Positive integer of maximum length of 3")
_GUICtrlNumberBox_Create("-9.999", -3.141, 0, 0, 100, 25)
GUICtrlSetTip(-1, "Format -9.999: Positive/negative real of length 1 before decimal point and length 3 after")
Integers, reals, bits and hexadecimal numbers can be formatted.
An existing control with GUICtrlCreateInput() can be turned into a numberbox like so:
$nNumberBox = GUICtrlCreateInput("123", 0, 0, 100, 25)
_NumberBoxAdd($nNumberBox,"999")
GUICtrlSetTip(-1,"The 999 number format is added later on to this standard input box")
To enable the numberboxes register it with _NumberBoxRegister(). And if you have your own $WM_COMMAND handle use _NumberBoxRegister($NB_REGISTER, $NB_NORUN) and put _NumberBoxHandler($hWnd,$iMsg,$wParam,$lParam) somewhere in your handler
Function | Description |
---|---|
_NumberBoxRegister | Registers or unregisters number input boxes message handler and/or reset variables |
_NumberBoxUnregister | Unregisters number input boxes message handler and/or reset variables |
_NumberBoxHandler | When having your own WM_COMMAND handler put this function in it to handle the numberbox input |
_GUICtrlNumberBox_Create | Creates an input box specific for numbers (decimal, binary or hexadecimal) |
_NumberBoxAdd | Makes a number box from an input box by adding a number format |
_NumberBoxRemove | Removes last added number input boxes from global array |
_NumberBoxCount | Returns number of number input boxes |
_NumberBoxPushCounter | Pushes the number input boxes counter to the position stack |
_NumberBoxPopCounter | Pops the number input boxes counter to the position stack |
_NumberBoxReset | Resets global array of number input boxes |