Function Reference

GUICtrlSetData

Modifies the data for a control.

GUICtrlSetData ( controlID, data [, default] )

 

Parameters

controlID The control identifier (controlID) as returned by a GUICtrlCreate... function.
data For Combo, List, ListViewItem : itemtext separated with |
For Progress : percent value
For Slider : value
For Group, Label, Button, Checkbox, Radio, Combo, List, Input, Edit, TabItem : text update
For Date : date or time depending the style of the control
For Dummy : value.
default [optional]
for Combo, List : the value that will be the default.
for Edit, Input : if defined and not "" the "data" string is inserted not overriding the previous value at the cursor point.

 

Return Value

Success: Returns 1.
Failure: Returns 0.
Returns -1 in case of invalid data

 

Remarks

For Combo or List control :
If the "data" corresponds to an already existing entry it is set as the default.
If the "data" starts with | or is an empty string "" the previous list is destroyed.

For ListViewItem control :
To update a specific column just forget about the others ie "||update" to update 3rd column.

 

Related

GUICtrlCreate..., GUICtrlSet..., GUICtrlRead

 

Example


#include <GUIConstants.au3>

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

GUICtrlCreateCombo ("", 10,10)

GUICtrlSetData(-1,"item1|item2|item3", "item3")

GUISetState ()       ; will display an empty dialog box with a combo control with focus on

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
   
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend