# 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;