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, or -1 for the last created control.
data Combo, List, ListView, ListViewItem: An Opt("GUIDataSeparatorChar",...) separated list of items.
Progress: The percentage.
Slider: The value.
Button, Checkbox, Combo, Edit, Group, Input, Label, List, Menu, MenuItem, Radio, TabItem, TreeViewItem: Replaces the text.
Date : The date or time depending the style of the control and the regional settings.
Dummy: The value.
default [optional]
Combo, List: The default value.
Edit, Input: If non-empty (""), the string is inserted at the current insertion point (caret).

Return Value

Success: 1.
Failure: 0.
-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 GUIDataSeparatorChar or is an empty string "" the previous list is destroyed. A trailing GUIDataSeparatorChar is ignored.

For ListView, ListViewItem controls :
To update a specific column just forget about the others ie "||update" to update 3rd column.
If "update" is empty the column/subitem will be erased. For example "|" will erase the second column/subitem, "" will erase the first.

For Monthcal controls :
The "data" date format is "yyyy/mm/dd".

For Date controls:
The date and time is in the format defined by the regional settings. GUICtrlRead() use the same default format.

Related

GUICtrlCreate..., GUICtrlRead, GUICtrlUpdate..., GUIDataSeparatorChar (Option)

Example

#include <GUIConstantsEx.au3>

Example()

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

    GUICtrlCreateCombo("", 10, 10)

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

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

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

        EndSwitch
    WEnd
EndFunc   ;==>Example