Hi,

wxTreeCtrl::HitTest

Regards

Mark

Daniel wrote:
Hi Vaughn,

thanks but the problem it still the same, the selected item is not the item I 
clicked with right mouse button because rightclicking does not select the item. 
So GetSelection or GetSelections returns not the (parent) item i need.

Regards
Daniel




----- Ursprüngliche Mail ----
Von: Vaughn Staples <[EMAIL PROTECTED]>
An: Daniel <[EMAIL PROTECTED]>; wxperlusers <[email protected]>
Gesendet: Mittwoch, den 23. April 2008, 14:38:25 Uhr
Betreff: Re: Getting the right item with wx::TreeCtrl

Daniel,

Perhaps something like the following would be useful:

EVT_TREE_ITEM_RIGHT_CLICK( $panel->{TreeCtrl}, $panel->{TreeCtrl}, \&_evt_tree_rmb_click );

#######################################
sub _evt_tree_rmb_click
#######################################
{
     my ($self,$event) = @_;
     my @selections    = $self->GetSelections();
     ##
     foreach my $selected_item ( @selections )
     {
          my $item_text  = $self->GetItemText( $selected_item );
my $item_data = $self->GetItemData( $selected_item )->GetData();
          my $reference  = ref $item_data;
          ##
          print "Selected Item: ($item_text), ($reference)\n";
          ##
     }
}

Vaugh

----- Original Message ----- From: "Daniel" <[EMAIL PROTECTED]>
To: "wxperlusers" <[email protected]>
Sent: Wednesday, April 23, 2008 8:22 AM
Subject: Getting the right item with wx::TreeCtrl


Hi all,

I have a wx::TreeCtrl an when the user right-clicks I want to do something with the childitems.

At first I tried this:

EVT_TREE_ITEM_RIGHT_CLICK($panel, $panel->{TreeCtrl}{"status"}, sub { my $selected = $panel->{TreeCtrl}{"status"} -> GetSelection(); my $parent = $panel->{TreeCtrl}{"status"} -> GetItemText($selected); F_MyMessage($self,"Status: $parent","Hinweis",wxOK|wxCENTRE|wxICON_INFORMATION);
     });

But as expected I get only the information of the selected item, not the one I clicked.

So i used GetItem from TreeEvent instead of GetSelection :
wxTreeEvent::GetItemwxTreeItemId GetItem() const
Returns the item (valid for all events).

           my $selected = $panel->{TreeCtrl}{"status"} -> GetItem();


--> Can't locate object method "GetItem" via package "Wx::TreeCtrl" at...

What am I doing wrong?


Regards Daniel









      __________________________________________________________
Gesendet von Yahoo! Mail.
Der Mailbox mit unbegrenztem Speicher.
http://de.overview.mail.yahoo.com





      __________________________________________________________
Gesendet von Yahoo! Mail.
Der Mailbox mit unbegrenztem Speicher.
http://de.overview.mail.yahoo.com


Reply via email to