Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Porting a wxPython List Control example into wxPerl: don't see column headings?

by McA (Priest)
on Mar 23, 2013 at 16:36 UTC ( #1025043=note: print w/ replies, xml ) Need Help??


in reply to Porting a wxPython List Control example into wxPerl: don't see column headings?

Hi,

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:

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;
Probably it helps you to find out what was wrong initially.

McA


Comment on Re: Porting a wxPython List Control example into wxPerl: don't see column headings?
Download Code
Re^2: Porting a wxPython List Control example into wxPerl: don't see column headings?
by HelenCr (Monk) on Mar 23, 2013 at 22:07 UTC

    McA: thank you for your time and investment of effort.

    I am studying your code, and if I have further questions I'll come back in a day or two.

    Lots of thanks - Helen

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1025043]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (15)
As of 2014-12-26 16:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (172 votes), past polls