Custom (GUI-Based) version of the Build-in function InputBox():
;=============================================================================== ; ; Function Name: _InputBox() ; Description: Custom InputBox Function (GUI based). ; Parameter(s): $Title - The title of the Input Box. ; $Prmt - A message to the user indicating what kind of input is expected. ; $sDef - [Optional] The value that the input box starts with. ; $hWnd - [Optional] Window handle of the parent. ; $IsPass - [optional] If <> 0 Then typed characters will be replaced with password characters (*). ; $IsDig - [optional] If <> 0 Then only numbers can by typed to the input. ; $Limit - [optional] Limit the input for accept N characters. ; $W - [optional] The width of the window. Use -1 for default width (200). ; $H - [optional] The height of the window. Use -1 for default height (150). ; $Left - [optional] The left side of the input box. By default (-1), the box is centered. ; $Top - [optional] The top of the input box. By default (-1), the box is centered. ; $Style - [optional] Defines the style of the GUI window (forced style(s): $WS_SIZEBOX). ; $exStyle - [optional] Defines the extended style of the GUI window. -1 is the default. ; $iTOut - [optional] How many seconds to wait before automatically cancelling the InputBox. ; ; Requirement(s): #include <GuiConstants.au3>. ; Return Value(s): String that was typed to the Input. ; Author(s): G.Sandler (a.k.a CreatoR). ; Note(s): None. ; ;===============================================================================
Example + UDF:
_InputBox.au3 4.71K 936 downloads
Added $Timeout param - It allows to set timeout (in seconds), just like in the original function InputBox().
Added focus of input when window is shown.
Added $IsDigits param - it allows to set the behaviour of typing in the input - if this parametr set to 1, then only digits can be typed in the InputBox.
Change the way that parent window is disabled (now its by WinSetState() - so its' work not just for Gui).
Change te example, now there is no parent gui, the inputbox is “attached” to currently active window.
Change the function completly - * Now it is possible to set limit for entered string, * the promt text is displayed more correct now, * and the input text are scrollable now ($ES_AUTOHSCROLL).
The Example + UDF attached to the post.
+ Little "cosmetic corrections" in the functions.
EDIT 8: (19.11.2007)
+ Added full description/comments to the main function.
* Changed example a little.
* Now the function and the example required #include <GuiConstants.au3> (see bellow why).
* The function now is stripped from “Magic Numbers”
Edited by MrCreatoR, 28 July 2012 - 05:49 PM.