develooper Front page | perl.wxperl.users | Postings from January 2013

Getting information from EVT_LIST_ITEM_RIGHT_CLICK

Thread Next
Dave Hayes
January 31, 2013 22:41
Getting information from EVT_LIST_ITEM_RIGHT_CLICK
Message ID:
Hello. I'm trying to get the text, column, and item index on a right 
click in a Wx::ListCtrl. The item index works perfectly. However, I 
can't seem to get any other information. Here's a very abbreviated idea 
of what I am doing:

   package MyList;
   use base qw(Wx::ListCtrl);

   sub new {
     my $self = shift;
     my $params = shift;

     $self = $self->SUPER::new(
       [ 600, 400 ],

       $self, $self,
       sub {
         my ($self, $event) = @_;
         my $item = $event->GetItem();
         my $index = $event->GetIndex();
         my $text = $event->GetText();
         my $col = $item->GetColumn();
         my $data = $item->GetData();
         my $text2 = $item->GetText();

         print "Item index $index => '$text' ($col, $data, $text2)\n";

   return $self;

This prints, for example:

   Item index 19 => '' (0, 0, )

What am I doing wrong, if anything? Thanks in advance.
Dave Hayes - Consultant - Altadena CA, USA -
 >>>> *The opinions expressed above are entirely my own* <<<<

Sometimes what a person escapes to is worse than what they
escaped from.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About