Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: wxPerl virtual list control not calling OnGetItemText?

by jmlynesjr (Friar)
on Mar 14, 2013 at 02:10 UTC ( #1023338=note: print w/ replies, xml ) Need Help??

in reply to wxPerl virtual list control not calling OnGetItemText?


I haven't played with a ListCtrl yet, but from my reading, to use a Virtual List Control you can't use ListCtrl directly. You have to subclass ListCtrl into a derived class like MyListCtrl. The derived class will include your OnGetItemText method which will be called instead of the default OnGetItemText method in ListCtrl which is happening now in your test code. Clear as mud yet?

Also wxLC_VIRTUAL can only be used with wxLC_REPORT so your MyListCtrl->new call has to include wxLC_VIRTUAL | wxLC_REPORT. I'm not sure what the 32 does that's in your code.

Example code from wxPerl Demo:

package Wx::DemoModules::wxListCtrl::Virtual; use strict; use base qw(Wx::ListCtrl Wx::DemoModules::wxListCtrl); use Wx qw(:listctrl wxRED wxBLUE wxITALIC_FONT wxDefaultPosition wxDefaultSize); sub new { my( $class, $parent ) = @_; my $self = $class->SUPER::new ( $parent, -1, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_VIRTUAL ); $self->bind_events; $self->create_menu; my( $small, $normal ) = $self->create_image_lists; $self->AssignImageList( $small, wxIMAGE_LIST_SMALL ); $self->AssignImageList( $normal, wxIMAGE_LIST_NORMAL ); $self->InsertColumn( 0, "Column 1" ); $self->InsertColumn( 1, "Column 2" ); $self->InsertColumn( 2, "Column 3" ); $self->InsertColumn( 3, "Column 4" ); $self->InsertColumn( 4, "Column 5" ); $self->SetItemCount( 100000 ); return $self; } sub OnGetItemText { my( $self, $item, $column ) = @_; return "( $item, $column )"; }

Remember that there is code in the wxPerl Demo example that you won't need. It's just there to support the structure of the demo.


There's never enough time to do it right, but always enough time to do it over...

Comment on Re: wxPerl virtual list control not calling OnGetItemText?
Select or Download Code
Re^2: wxPerl virtual list control not calling OnGetItemText?
by stefbv (Deacon) on Mar 14, 2013 at 10:39 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1023338]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2015-01-30 08:07 GMT
Find Nodes?
    Voting Booth?

    My top resolution in 2015 is:

    Results (248 votes), past polls