| Wx-Perl-DirTree documentation | view source | Contained in the Wx-Perl-DirTree distribution. |
Wx::Perl::DirTree - A directory tree widget for wxPerl
version 0.07
use Wx::Perl::DirTree; my $panel = Wx::Panel->new; my $tree = Wx::Perl::DirTree->new( $panel, [100,100] ); my $main_sizer = Wx::BoxSizer->new( wxVERTICAL ); $main_sizer->Add( $tree->GetTree, 0, wxTOP, 0 ); # in a subroutine print $tree->GetSelectedPath;
Many widgets that display directory trees are dialogs or can't handle drives on Windows. This module aims to fill the gap. It can be integrated in any frame or dialog and it handles drives under Windows.
$tree->GetSelectedPath
This method returns the path of the item that is selected.
$tree->GetTree
This is just a convenience method that wraps the GetTree method of Wx::Perl::VirtualTree.
Creates a new object
my $tree = Wx::Perl::DirTree->new( $panel, [100,100] );
my $tree2 = Wx::Perl::DirTree->new(
$panel,
[100,100],
{
dir => $path_to_dir,
}
);
my $tree2 = Wx::Perl::DirTree->new(
$panel,
[100,100],
{
dir => $path_to_dir,
is_root => 1,
}
);
Parameters:
A parent widget.
The size of the tree widget. This has to be an array reference.
In this hash reference you can specifiy more parameters:
If you want to "open" a specific directory, you can specify "dir"
If set to a true value, the dir tree starts at the specified directory. If you want to provide a directory tree that shows only the directories below the home directory of a user you can do this:
Wx::Perl::DirTree->new(
$panel,
$size,
{
dir => File::HomeDir->my_home,
is_root => 1,
}
);
With that option you can specify whether only directories or only files can be selected. If this option is ommitted, both types can be selected.
use Wx::Perl::DirTree qw(:const); # loads two constants
my $tree = Wx::Perl::DirTree->new(
$panel,
$size,
{
dir => File::HomeDir->my_home,
allowed => wxPDT_DIR, # only directories can be selected
}
);
See also the scripts in the example dir.
Renee Baecker <module@renee-baecker.de>
This software is Copyright (c) 2010 by Renee Baecker.
This is free software, licensed under:
The Artistic License 2.0
| Wx-Perl-DirTree documentation | view source | Contained in the Wx-Perl-DirTree distribution. |