Function Reference


GUICtrlCreateInput

Creates an Input control for the GUI.

GUICtrlCreateInput ( "text", left, top [, width [, height [, style = -1 [, exStyle = -1]]]] )

Parameters

text The text of the control.
left The left side of the control. If -1 is used then left will be computed according to GUICoordMode.
top The top of the control. If -1 is used then top will be computed according to GUICoordMode.
width [optional] The width of the control (default is the previously used width).
height [optional] The height of the control (default is the previously used height).
style [optional] Defines the style of the control. See GUI Control Styles Appendix.
    default ( -1) : $ES_LEFT, $ES_AUTOHSCROLL
    forced styles : $WS_TABSTOP only if no $ES_READONLY. $ES_MULTILINE is always reset.
exStyle [optional] Defines the extended style of the control. See Extended Style Table.
    default ( -1) : $WS_EX_CLIENTEDGE

Return Value

Success: the identifier (controlID) of the new control.
Failure: 0.

Remarks

To obtain the value of the control see GUICtrlRead().
To set or change information in the control see GUICtrlUpdate...() functions.

For defining an input control for entering passwords (input is hidden with an asterisk) use the $ES_PASSWORD style.

If you want to drag & drop a filename onto this control just add the WS_EX_ACCEPTFILES extended style on the GUICreate() and set the state to $GUI_DROPACCEPTED.
After multiple drag and drop files on this control, you can retrieve the files name which are separated by "|" with GUICtrlRead().

 To use the values specified above you must #include <EditConstants.au3> in your script.

Default resizing is $GUI_DOCKHEIGHT.

Related

GUICoordMode (Option), GUICtrlUpdate..., GUIGetMsg, GUICtrlRead, GUICtrlCreateUpdown, GUICtrlSetLimit

Example

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Local $file, $btn, $msg

    GUICreate(" My GUI input acceptfile", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, $WS_EX_ACCEPTFILES)
    $file = GUICtrlCreateInput("", 10, 5, 300, 20)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    GUICtrlCreateInput("", 10, 35, 300, 20) ; will not accept drag&drop files
    $btn = GUICtrlCreateButton("Ok", 40, 75, 60, 20)

    GUISetState(@SW_SHOW)

    $msg = 0

    ; Loop until the user exits.
    While $msg <> $GUI_EVENT_CLOSE
        $msg = GUIGetMsg()
        Select
            Case $msg = $btn
                ExitLoop
        EndSelect
    WEnd

    MsgBox($MB_SYSTEMMODAL, "drag drop file", GUICtrlRead($file))
EndFunc   ;==>Example