Helen:
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.
James
There's never enough time to do it right, but always enough time to do it over...
In reply to Re: wxPerl virtual list control not calling OnGetItemText?
by jmlynesjr
in thread wxPerl virtual list control not calling OnGetItemText?
by HelenCr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |