logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: Wx::TreeCtrl and ImageList assignment: msg#00014

Subject: Re: Wx::TreeCtrl and ImageList assignment
Tom Panzarella <tpanzarella@xxxxxxxxxxxxxxxxxxxxxxx> writes:

> I have a Wx::TreeCtrl that I want to assign a Wx::ImageList of icons
> to so that I can access them by index and associate them with the
> nodes in the tree.  It seems as though, "AssignImageList" and
> "AssignButtonsImageList" are unimplemented in wxPerl?  I get errors
> stating that the method cannot be found.  So I tried the *harder*
> route of using "SetImageList".  The SetImageList call succeeds, but
> when I make this call:
>
> $tree->AddRoot($text, $idx);

This is what I have in my 'new' method of the tree control:

    $self->{IMAGELIST} = Wx::ImageList->new(16, 16, 1);
    $self->{IMAGELIST}->Add(Wx::Bitmap->new("....xpm", wxBITMAP_TYPE_XPM));
    $self->{IMAGELIST}->Add(Wx::Bitmap->new("....xpm", wxBITMAP_TYPE_XPM));
    $self->{IMAGELIST}->Add(Wx::Bitmap->new("....xpm", wxBITMAP_TYPE_XPM));
    ...
    $self->SetImageList($self->{IMAGELIST} );

To associate a node with image at index $ix:

    $ctl->AppendItem($item, $title, $ix, $ix, ...);

Hope this helps.

-- Johan


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>