Hi,

Wrong EVT

See EVT_LIST_COL_RIGHT_CLICK

Regards

Mark

On 31/01/2013 22:41, Dave Hayes wrote:
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(
       $params->{'parent'},
       -1,
       wxDefaultPosition,
       [ 600, 400 ],
       wxLC_REPORT|wxLC_VIRTUAL|wxLC_HRULES,
     );

   ...
     EVT_LIST_ITEM_RIGHT_CLICK(
       $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.

Reply via email to