Win32::AutoItX::Control::TreeView - OO interface for TreeView32 controls
use Win32::AutoItX; my $a = Win32::AutoItX->new; my $pid = $a->Run('regedit.exe'); my $window = $a->get_window('Registry Editor'); $window->wait; $window->show; my $treeview = $window->get_control('SysTreeView321')->treeview(); $treeview->expand('#0'); for my $i (0 .. $treeview->count('#0') - 1) { print "Item #$i = ", $treeview->text("#0|#$i"), "\n"; } $treeview->expand('Computer|HKEY_LOCAL_MACHINE'); $treeview->select('Computer|HKEY_LOCAL_MACHINE|SOFTWARE');
Win32::AutoItX::Control::TreeView provides an object-oriented interface for AutoItX methods to operate with TreeView32 (SysTreeView32) controls.
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:
$item
Heading1 ----> H1SubItem1 ----> H1SubItem2 ----> H1SubItem3 ----> ----> H1S1SubItem1 Heading2 Heading3
Each "level" is separated by |. An index is preceded with #. For example:
Item $item Heading2 "Heading2" or "#1" H1SubItem2 "Heading1|H1SubItem2" or "#0|#1" H1S1SubItem1 "Heading1|H1SubItem3|H1S1SubItem1" or "#0|#2|#0"
$treeview = Win32::AutoItX::Control::TreeView->new($control)
creates a TreeView object.
$count = $treeview->count($item)
returns the number of children for a selected item.
$boolean = $treeview->exists($item)
returns 1 if an item exists, otherwise 0.
$text = $treeview->text()
returns the text of an item.
$checked = $treeview->is_checked($item)
returns the state of an item. 1:checked, 0:unchecked, -1:not a checkbox.
$treeview->check($item)
checks an item (if the item supports it).
$treeview->uncheck($item)
unchecks an item (if the item supports it).
$treeview->collapse($item)
collapses an item to hide its children.
$treeview->expand($item)
expands an item to show its children.
$treeview->select($item)
selects an item.
$item = $treeview->selected($use_index)
returns the item reference of the current selection using the text reference of the item (or index reference if $use_index is set to 1).
$use_index
This module also provides most of Win32::AutoItX::Control methods.
Mikhail Telnov <Mikhail.Telnov@gmail.com>
This software is copyright (c) 2017 by Mikhail Telnov.
This library is free software; you may redistribute and/or modify it under the same terms as Perl itself.
To install Win32::AutoItX, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Win32::AutoItX
CPAN shell
perl -MCPAN -e shell install Win32::AutoItX
For more information on module installation, please visit the detailed CPAN module installation guide.