Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-04-19 11:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found