Read state or data of a control.
GUICtrlRead ( controlID )
Parameters
controlID | The control identifier (controlID) as returned by a GUICtrlCreate... function. |
Return Value
Success: | Returns depending the control (see below). |
Failure: | Returns 0. |
Type | Value |
Checkbox, Radio | state of the button. See State table |
Combo, List | The value selected |
Input, Edit | The text entered |
Button | The display text |
Date | The selected date |
Progress | Current percentage |
Slider | Current value |
Tab | The number of the tabitem selected |
Menu, MenuItem | State of the menu/item. See State table |
TreeView | Control identifier (controlID) of the selected TreeViewItem |
TreeViewItem | State of the TreeViewItem |
ListView | Control identifier (controlID) of the selected ListViewItem. 0 means no item is selected |
Dummy | The value set by GUICtrlSendToDummy or GUICtrlSetData |
Remarks
None.
Related
GUICtrlSet..., GUIGetMsg
Example
#include <GUIConstants.au3>
GUICreate("My GUICtrlRead") ; will create a dialog box that when displayed is centered
$n1=GUICtrlCreateList ("", 10,10,-1,100 )
GUICtrlSetData(-1,"item1|item2|item3", "item2")
$n2=GUICtrlCreateButton ("button",0,100)
GUICtrlSetState(-1,$GUI_FOCUS) ; the focus is on this button
GUISetState () ; will display an empty dialog box
; Run the GUI until the dialog is closed
Do
$msg = GUIGetMsg()
if $msg = $n2 then
msgbox(0,"list=", GUICtrlRead($n1)) ; display the value
endif
Until $msg = $GUI_EVENT_CLOSE