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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.