NAME

Win32::AutoItX::Control::TreeView - OO interface for TreeView32 controls

SYNOPSIS

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');

DESCRIPTION

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:

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"

METHODS

new

$treeview = Win32::AutoItX::Control::TreeView->new($control)

creates a TreeView object.

count

$count = $treeview->count($item)

returns the number of children for a selected item.

exists

$boolean = $treeview->exists($item)

returns 1 if an item exists, otherwise 0.

text

$text = $treeview->text()

returns the text of an item.

is_checked

$checked = $treeview->is_checked($item)

returns the state of an item. 1:checked, 0:unchecked, -1:not a checkbox.

check

$treeview->check($item)

checks an item (if the item supports it).

uncheck

$treeview->uncheck($item)

unchecks an item (if the item supports it).

collapse

$treeview->collapse($item)

collapses an item to hide its children.

expand

$treeview->expand($item)

expands an item to show its children.

select

$treeview->select($item)

selects an item.

selected

$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).

Win32::AutoItX::Control methods

This module also provides most of Win32::AutoItX::Control methods.

SEE ALSO

Win32::AutoItX::Control
Win32::AutoItX
AutoItX Help
https://www.autoitscript.com/autoit3/docs/functions/ControlTreeView.htm

AUTHOR

Mikhail Telnov <Mikhail.Telnov@gmail.com>

COPYRIGHT

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.