note
McA
<p>Hi,</p>
<p>being curious I digged around a bit having more or less no clue about the building blocks of wxPerl, but I got a little nice looking window with the following code:
<code>
use strict;
use warnings;
use Wx;
use Carp qw {cluck};
package MainWindow;
use Wx ':everything';
use parent -norequire, 'Wx::Frame';
sub new {
my $class = shift;
my $self = $class->SUPER::new(
undef,
-1,
'Test',
[-1, -1],
[-1, -1],
);
# we need a panel
my $panel = Wx::Panel->new($self);
$panel->SetBackgroundColour(wxGREEN);
$self->{panel} = $panel;
# create a list control with content
my $lc = Wx::ListCtrl->new(
$panel,
-1,
wxDefaultPosition,
wxDefaultSize,
wxLC_REPORT,
);
$lc->InsertColumn(0, 'Column1', wxLIST_FORMAT_LEFT, 150);
$lc->InsertColumn(1, 'Column2', wxLIST_FORMAT_LEFT, 150);
for my $i (1..10) {
my $id = $lc->InsertStringItem($i, "Item $i");
$lc->SetItem($id, 1, $i, -1);
$lc->SetItemData($id, 100 + $i);
}
$self->{list} = $lc;
# put sizers in
my $panelsizer = Wx::BoxSizer->new(wxVERTICAL);
my $mainsizer = Wx::BoxSizer->new(wxVERTICAL);
$panelsizer->Add($lc, 1, wxEXPAND|wxALL, 0);
$panel->SetSizer($panelsizer);
$mainsizer->Add($panel, 1, wxEXPAND|wxALL, 0);
$self->SetSizer( $mainsizer );
return $self;
}
my $app = Wx::SimpleApp->new;
my $win = MainWindow->new;
$win->Show(1);
$app->MainLoop;
</code>
Probably it helps you to find out what was wrong initially.</p>
<p>McA</p>
1025024
1025024