Function Reference


GUICtrlCreateList

Creates a List control for the GUI.

GUICtrlCreateList ( "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) : $LBS_SORT, $WS_BORDER, $WS_VSCROLL
    forced styles : $WS_TABSTOP, $LBS_NOTIFY
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.

The different list entries that can be selected can be set with GUICtrlSetData()

To limit horizontal scrolling use GUICtrlSetLimit()

To combine styles with the default style use BitOR($GUI_SS_DEFAULT_LIST, newstyle, ... ).
To use the values specified above you must #include <ListBoxConstants.au3> in your script.

Default resizing is $GUI_DOCKAUTO size and position will occur.

Related

GUICoordMode (Option), GUICtrlSetData, GUICtrlSetLimit, GUICtrlUpdate..., GUIGetMsg

Example

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

Example()

Func Example()
        Local $sMESSAGE = "The following buttons have been clicked"

        GUICreate("My GUI list") ; will create a dialog box that when displayed is centered

        Local $idButton_Add = GUICtrlCreateButton("Add", 64, 32, 75, 25)
        Local $idButton_Clear = GUICtrlCreateButton("Clear", 64, 72, 75, 25)
        Local $idMylist = GUICtrlCreateList("buttons that have been clicked", 176, 32, 121, 97)
        GUICtrlSetLimit(-1, 200) ; to limit horizontal scrolling
        GUICtrlSetData(-1, $sMESSAGE)
        Local $idButton_Close = GUICtrlCreateButton("my closing button", 64, 160, 175, 25)

        GUISetState(@SW_SHOW)

        ; Loop until the user exits.
        While 1
                Switch GUIGetMsg()
                        Case $GUI_EVENT_CLOSE
                                ExitLoop
                        Case $idButton_Add
                                GUICtrlSetData($idMylist, "You clicked button No1|")
                        Case $idButton_Clear
                                GUICtrlSetData($idMylist, "")
                        Case $idButton_Close
                                MsgBox($MB_SYSTEMMODAL, "", "the closing button has been clicked", 2)
                                Exit
                EndSwitch
        WEnd
EndFunc   ;==>Example