HelenCr has asked for the wisdom of the Perl Monks concerning the following question:
Esteemed PerlMonks: I hope you can help me with this problem:
I am trying to implement a (trivial) virtual list control demo. It should show a frame, and fill-in all fields with the word: "test".
When I run the program (listed below), it shows the frame and the title, including the scroll bar and the horizontal lines, but it seems that the virtual ListCtrl doesn't call OnGetItemText, so the fields do not get populated.
I'd be very thankful to you if you could help in finding where the error is.
My systems: Strawberry Perl 5.16.0 on Windows XP (same results with DWIM Perl 5.14.2 on Windows 7).
Many TIA - Helen
The program:
# wxPerl Virtual list control test use strict; use warnings; use warnings qw< FATAL utf8 >; use Wx; use Encode; use 5.014; use utf8; use autodie; use Carp; use Carp qw {cluck}; use Carp::Always; use Win32::Console; use English '-no_match_vars'; package MyForm; use strict; use warnings; use Wx qw[:everything]; use base 'Wx::Frame'; sub new { #1 my $class = shift; my $self = $class->SUPER::new( undef, # parent window -1, # ID -1 means any 'Phone book', # title [ 200, 200 ], # position [ 400, 500 ], # size ); # Add a panel my $panel = Wx::Panel->new( $self, # parent window -1, # ID ); $self->{list_ctrl} = Wx::ListCtrl->new( $panel, -1, # ID [ 20, 30 ], # position [ 350, 300 ], # size 32 | Wx::wxBORDER_SUNKEN | Wx::wxLC_VIRTUAL | Wx::wxLC_HRULES, + # window style ); $self->{list_ctrl}->InsertColumn( 0, 'Last Name' ); $self->{list_ctrl}->InsertColumn( 1, 'First Name' ); $self->{list_ctrl}->InsertColumn( 2, 'Addr City' ); $self->{list_ctrl}->InsertColumn( 3, 'Addr State' ); my $sizer = Wx::BoxSizer->new(wxVERTICAL); $sizer->Add( $self->{list_ctrl}, 0, wxALL | wxEXPAND, 5 ); $panel->SetSizer($sizer); $self->{list_ctrl}->SetItemCount(1000); return $self; } #1 end sub new sub OnGetItemText { #1 MyForm:: say 'Entered OnGetItemText'; my ($line, $column, $data_item); my ($self, $item, $col) = @_; $data_item = 'test'; return $data_item; } #1 end sub OnGetItemText MyForm:: # end package MyForm binmode(STDOUT, ":unix:utf8"); binmode $DB::OUT, ':unix:utf8' if $DB::OUT; # for the debugger my $app = Wx::SimpleApp->new; my $frame = MyForm->new; $frame->Show(1); $app->MainLoop;
Note: trying to cross-post here: http://old.nabble.com/wxPerl-virtual-list-control-not-calling-OnGetItemText--tt35170291.html
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: wxPerl virtual list control not calling OnGetItemText?
by Anonymous Monk on Mar 14, 2013 at 02:59 UTC | |
Re: wxPerl virtual list control not calling OnGetItemText?
by jmlynesjr (Deacon) on Mar 14, 2013 at 13:18 UTC | |
by HelenCr (Monk) on Mar 14, 2013 at 17:18 UTC | |
Re: wxPerl virtual list control not calling OnGetItemText?
by jmlynesjr (Deacon) on Mar 14, 2013 at 02:10 UTC | |
by stefbv (Curate) on Mar 14, 2013 at 10:39 UTC |