Ticket #2600: GUICtrlSetState.txt

File GUICtrlSetState.txt, 3.7 KB (added by mlipok, 11 years ago)
Line 
1###Function###
2GUICtrlSetState
3
4###Description###
5Changes the state of a control.
6
7###Syntax###
8GUICtrlSetState ( controlID, state )
9
10
11###Parameters###
12@@ParamTable@@
13controlID
14        The control identifier (controlID) as returned by a <a href="GUICtrlCreate Management.htm">GUICtrlCreate...()</a> function, or -1 for the last created control.
15state
16        See the <a href="#StateTable">State table</a> below.
17@@End@@
18
19###ReturnValue###
20@@ReturnTable@@
21Success:        1.
22Failure:        0.
23@@End@@
24
25
26###Remarks###
27
28        <a id="StateTable"></a><b>State table</b>
29
30@@StandardTable1@@
31<b>State</b>    <b>Comments</b>
32No Change (0)   
33$GUI_CHECKED (1)        Radio, Checkbox or ListViewItem will be checked.
34$GUI_INDETERMINATE (2)  Checkbox having the tristate attribute will be greyed.
35$GUI_UNCHECKED (4)      Radio, Checkbox or ListViewItem will be unchecked.
36$GUI_DROPACCEPTED (8)   Control will accept drop action : from file or from a drag of another control. See remarks.
37$GUI_SHOW (16)  Control will be visible. On Tabitem control will select the first tab to be displayed.
38$GUI_HIDE (32)  Control will not be visible.
39$GUI_ENABLE (64)        Control will be enabled.
40$GUI_DISABLE (128)      Control will be greyed out.
41$GUI_FOCUS (256)        Control will be given input/selected focus.
42$GUI_DEFBUTTON (512)    Control will be set as the default button on the window. See remark about TreeviewItems.
43$GUI_EXPAND (1024)      TreeViewItem will expand its child items.
44$GUI_ONTOP (2048)       Control will be have the ontop attribute for the window (zOrdering).
45$GUI_NODROPACCEPTED (4096)      Control will  not accept drop action.
46$GUI_NOFOCUS (8192)     Listview control will loose focus.
47$GUI_AVISTART (0)       Avi control will start playing.
48$GUI_AVISTOP (1)        Avi control will stop playing.
49$GUI_AVICLOSE (2)       Avi control will stop playing and release resource.
50@@End@@
51
52State values can be summed up as for example $GUI_DISABLE (128) + $GUI_HIDE (32) sets the control in an disabled and hidden state.
53
54If an AVI control has to be hidden with $GUI_HIDE (32) it should be closed with $GUI_AVICLOSE (1).
55
56State of a "contextmenu" control <b>cannot be changed.</b>
57State of a "listviewitem" control can be changed if the associated "listview" control has been created with an extended style $LVS_EX_CHECKBOXES. $GUI_FOCUS (256) and $GUI_NOFOCUS (8192) can be used on specific listviewitem provided listview control style allows to display it : $LVS_SHOWSELALWAYS.
58State of a "menu or a ""menuitem" control <b>cannot be hidden.</b>
59
60! Important information for $GUI_EXPAND: this state is only used for TreeViewItems. If you want to use this 'action' then at least 1 Sub-TreeViewItem has to exist/created under this item !
61If you want to select another item in a TreeView then you can use $GUI_FOCUS (256) - the parent TreeView gets the window focus and the specified item is marked as selected.
62If you want to set a treeview item as a default item which means painting it bold you can use $GUI_DEFBUTTON (512) - to turn it off just use another value but $GUI_DEFBUTTON (512), for instance 0. This state will not be returned by <a href="GUICtrlGetState.htm">GUICtrlGetState()</a>.
63
64If $GUI_DROPACCEPTED (8) is set to a visible control a drag & drop can be taken in account. The edit/input control will be set with the filename.
65For other controls on reception of $GUI_EVENT_DROPPED, @GUI_DragId will return the controlID from where the drag start (-1 if from a file, @GUI_DragFile contain the filename being dropped) and @GUI_DropId returns the controlID of the dropped control.
66Only dragging a ListviewItem will start the drag & drop process. The @GUI_DragId will be the ListView controlID.
67
68
69###Related###
70GUICtrlCreate..., GUICtrlGetState
71
72
73###Example###
74@@IncludeExample@@