ControlTreeView: Difference between revisions
Jump to navigation
Jump to search
(Created page with "==Description== Sends a command to a TreeView32 control. ==Syntax== <syntaxhighlight lang='autoit'> ControlTreeView ( "title", "text", controlID, "command" [, option1 [, opti...") |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== | <!-- Autogenerated Wiki Page. --> | ||
Sends a command to a TreeView32 control. | <!-- Not meant to be user editable. --> | ||
<!-- If there is an error here then that means that there is an error in the helpfile. --> | |||
<!-- Report it to Trac with category 'Documentation'. --> | |||
<!-- See this post for more info: http://www.autoitscript.com/forum/topic/153680-convert-helpfile-to-wiki-text/--> | |||
<font face='Segoe UI, Courier New, Lucida Grande, Verdana, Helvetica, sans-serif'> | |||
<font size='3' weight='normal'>Sends a command to a TreeView32 control.</font> | |||
<font face='Courier New'><div id='Syntax' style='background-color:#FFFFAA;'> | |||
:ControlTreeView ( "title", "text", controlID, "command" [, option1 [, option2]] ) | |||
</div></font> | |||
==Parameters== | ===<font size=4><div id='Section' style='color:#DB7100;'>Parameters</div></font>=== | ||
{| | {| class='wikitable' | ||
|- | |- | ||
| | | title || The title/hWnd/class of the window to access. See [http://www.autoitscript.com/autoit3/docs/intro/windowsadvanced.htm Title special definition]. | ||
|- | |- | ||
| | | text || The text of the window to access. | ||
|- | |- | ||
| | | controlID || The control to interact with. See [http://www.autoitscript.com/autoit3/docs/intro/controls.htm Controls]. | ||
|- | |- | ||
| | | command || The command to send to the control (see below). | ||
|- | |- | ||
| | | option1 || '''[optional]''' Additional parameter required by some commands. | ||
|- | |- | ||
| option2 || '''[optional]''' Additional parameter required by some commands. | |||
|} | |} | ||
===<font size=4><div id='Section' style='color:#DB7100;'>Return Value</div></font>=== | |||
Depends on the command as table below shows. In case of an error (such as an invalid command or window/control could not be found) then @error is set to 1. | |||
{| class='wikitable' | |||
! | '''Command''', '''Option1''', '''Option2''' | |||
| | |||
| | |||
|} | |} | ||
The "item" parameter is a string-based parameter that is used to reference a particular treeview item using a combination of text and indices. Indices are 0-based. For example: | The "item" parameter is a string-based parameter that is used to reference a particular treeview item using a combination of text and indices. Indices are 0-based. For example: | ||
Heading1 | |||
----> H1SubItem1 | ----> H1SubItem1 | ||
----> H1SubItem2 | ----> H1SubItem2 | ||
Line 63: | Line 52: | ||
Heading3 | Heading3 | ||
Each "level" is separated by |. An index is preceded with #. Examples: | |||
{| | {| class='wikitable' | ||
!! | ! | '''Item''' | ||
! | '''Item Reference''' | |||
|- | |- | ||
| | | Heading2 || "Heading2" or "#1" | ||
|- | |- | ||
| | | H1SubItem2 || "Heading1|H1SubItem2" or "#0|#1" | ||
|- | |- | ||
| H1S1SubItem1 || "Heading1|H1SubItem3|H1S1SubItem1" or "#0|#2|#0" | |||
|} | |} | ||
References can also be mixed like "Heading1|#1". | References can also be mixed like "Heading1|#1". | ||
==Remarks== | |||
===<font size=4><div id='Section' style='color:#DB7100;'>Remarks</div></font>=== | |||
As AutoIt is a 32-bit application some commands are not available when referencing a 64-bit application as Explorer when running on 64-bit Windows. | As AutoIt is a 32-bit application some commands are not available when referencing a 64-bit application as Explorer when running on 64-bit Windows. | ||
==Related== | |||
===<font size=4><div id='Section' style='color:#DB7100;'>Related</div></font>=== | |||
[[ControlCommand]] | [[ControlCommand]] | ||
==Example== | ===<font size=4><div id='Section' style='color:#DB7100;'>Example</div></font>=== | ||
<syntaxhighlight lang='autoit'> | <syntaxhighlight lang='autoit'> | ||
#include <GUIConstantsEx.au3> | #include <GUIConstantsEx.au3> | ||
Line 125: | Line 118: | ||
EndFunc ;==>Example | EndFunc ;==>Example | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</font> | |||
__NOTOC__ | |||
__NOEDITSECTION__ |
Latest revision as of 16:15, 23 August 2013
Sends a command to a TreeView32 control.
- ControlTreeView ( "title", "text", controlID, "command" [, option1 [, option2]] )
Parameters
title | The title/hWnd/class of the window to access. See Title special definition. |
text | The text of the window to access. |
controlID | The control to interact with. See Controls. |
command | The command to send to the control (see below). |
option1 | [optional] Additional parameter required by some commands. |
option2 | [optional] Additional parameter required by some commands. |
Return Value
Depends on the command as table below shows. In case of an error (such as an invalid command or window/control could not be found) then @error is set to 1.
Command, Option1, Option2 |
---|
The "item" parameter is a string-based parameter that is used to reference a particular treeview item using a combination of text and indices. Indices are 0-based. For example:
Heading1
> H1SubItem1
> H1SubItem2
> H1SubItem3
> ----> H1S1SubItem1
Heading2 Heading3
Each "level" is separated by |. An index is preceded with #. Examples:
Item | Item Reference |
---|---|
Heading2 | "Heading2" or "#1" |
H1SubItem2 | H1SubItem2" or "#0|#1" |
H1S1SubItem1 | H1SubItem3|H1S1SubItem1" or "#0|#2|#0" |
References can also be mixed like "Heading1|#1".
Remarks
As AutoIt is a 32-bit application some commands are not available when referencing a 64-bit application as Explorer when running on 64-bit Windows.
Related
Example
#include <GUIConstantsEx.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
Example()
Func Example()
Local $hGUI = GUICreate("ControlTreeView Example", 212, 212)
Local $iTreeView_1 = GUICtrlCreateTreeView(6, 6, 200, 160, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_CHECKBOXES), $WS_EX_CLIENTEDGE)
Local $hTreeView_1 = ControlGetHandle($hGUI, "", $iTreeView_1)
Local $iRoot = GUICtrlCreateTreeViewItem("Root", $iTreeView_1)
GUICtrlCreateTreeViewItem("Item 1", $iRoot)
GUICtrlCreateTreeViewItem("Item 2", $iRoot)
GUICtrlCreateTreeViewItem("Item 3", $iRoot)
Local $iItem_4 = GUICtrlCreateTreeViewItem("Item 4", $iRoot)
GUICtrlCreateTreeViewItem("Item 4.1", $iItem_4)
GUICtrlCreateTreeViewItem("Item 4.2", $iItem_4)
GUICtrlCreateTreeViewItem("Item 5", $iRoot)
GUISetState(@SW_SHOW, $hGUI)
ControlTreeView($hGUI, "", $hTreeView_1, "Expand", "Root")
ControlTreeView($hGUI, "", $hTreeView_1, "Exists", "Root|Item 4")
ControlTreeView($hGUI, "", $hTreeView_1, "Check", "Root|Item 4")
ControlTreeView($hGUI, "", $hTreeView_1, "Select", "Root|Item 4")
ControlTreeView($hGUI, "", $hTreeView_1, "Expand", "Root|Item 4")
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete($hGUI)
EndFunc ;==>Example