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

Re: Getting information from EVT_LIST_ITEM_RIGHT_CLICK

Thread Previous | Thread Next
From:
Mark Dootson
Date:
February 1, 2013 00:29
Subject:
Re: Getting information from EVT_LIST_ITEM_RIGHT_CLICK
Message ID:
510B0C6A.6080404@znix.com
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.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About