Hi
If you search for "root" in http://docs.wxwidgets.org/trunk/classwx_tree_ctrl.html you'll find
wxTR_LINES_AT_ROOT: Use this style to show lines between root nodes. Only applicable if wxTR_HIDE_ROOT is set and wxTR_NO_LINES is not set.
wxTR_HIDE_ROOT: Use this style to suppress the display of the root node, effectively causing the first-level nodes to appear as a series of root nodes.
So this is what that looks like
#!/usr/bin/perl -- use strict; use warnings; use Wx; use Wx::Perl::TreeChecker; my $frame = Wx::Frame->new( undef, -1, 'Wx::Perl::TreeChecker' ); my $tree = Wx::Perl::TreeChecker->new( $frame, -1, [ -1, -1 ], [ -1, -1 ], Wx::wxTR_DEFAULT_STYLE() | Wx::wxTR_HIDE_ROOT() ^ Wx::wxTR_LINES_AT_ROOT() ); if( $tree ->IsEmpty ){ $tree -> AddRoot('/'); } my $root = $tree->GetRootItem; for my $ix (1..10){ my $id = $tree->AppendItem ($root, "noot $ix"); $tree->AppendItem ($id, "$_ noot $ix") for 1..3; } $tree->ExpandAll; $frame->Show(1); Wx::SimpleApp->new->MainLoop;
In your code change the constructor
$self -> {treechecker} = Wx::Perl::TreeChecker->new( $panel, -1, [ -1, -1 ], [ -1, -1 ], Wx::wxTR_DEFAULT_STYLE() | Wx::wxTR_HIDE_ROOT() ^ Wx::wxTR_LINES_AT_ROOT() );
and modify _populate_tree
if( $tree ->IsEmpty ){ $tree -> AddRoot('/'); } my $root = $tree->GetRootItem; my $stream_id = $tree-> AppendItem( $root, $stream ); _populate_tree($tree, $stream_id, $data->{$stream});
In reply to Re: Wx::Perl::TreeChecker multiple root nodes
by beech
in thread Wx::Perl::TreeChecker multiple root nodes
by swamprich
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |