We just found a solution in case anyone else should have a need for this.
You can tie the EVT_LEFT_DOWN event to the listctrl widget and use
$event->GetPosition to get the coordinates at the time of left
clicking. Loop through your columns keeping a running total of their
widths. If $pos->x is less than the running total, that's the column
you're in.
Mike
Wx::Event::EVT_LEFT_DOWN($this, sub {
my ($self, $event)=@_;
my $pos=$event->GetPosition;
my $total=0;
my $in_col=-1;
for(my $col=0;$col<$this->GetColumnCount;$col++){
$total+=$this->GetColumnWidth($col);
if($pos->x<=$total){
$in_col=$col;
last;
}
}
print "in_col=$in_col\n";
$event->Skip(1);
}
Quoting [email protected]:
Hello,
Is there any way to identify which wxListCtrl column is clicked
within an EVT_LIST_ITEM_SELECTED event? The GetColumn function
pertains to only EVT_LIST_COL_** events, but I'm looking for
something relating to the rows of data not the column headers.
As a workaround I tried GetItemRect($item) to get the X and Y coords
and Width/Height in an attempt to calculate the column positions
myself, but that seems to return X=0 and Y=21 Width=0 and Height=0
regardless of where in the control I click.
Does anyone have any ideas?
Many thanks,
Mike
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit
http://www.messagelabs.com/email______________________________________________________________________
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit
http://www.messagelabs.com/email______________________________________________________________________