That error was the easiest part..., I made a few changes and fixes and this is the result, to keep the development going :)

package MyForm; use strict; use warnings; use Wx qw[:everything]; # easy when testing use Wx::Event qw(EVT_BUTTON); use base 'Wx::Frame'; use Wx::Perl::ListCtrl; sub new { my $class = shift; my $self = $class->SUPER::new( undef, # parent window -1, # ID -1 means any 'List Control Tutorial', # title [ -1, -1 ], # default position [ 400, 300 ], # size ); # Add a panel so it looks correct on all platforms my $panel = Wx::Panel->new( $self, # parent window -1, # ID ); my $idx = 0; $self->{list_ctrl} = Wx::Perl::ListCtrl->new( $panel, -1, # ID #'Report', # label [ 20, 30 ], # position [ -1, 100 ], # size wxLC_REPORT | wxBORDER_SUNKEN, # window style ); $self->{list_ctrl}->InsertColumn( 0, 'Subject' ); $self->{list_ctrl}->InsertColumn( 0, 'Due' ); $self->{list_ctrl}->InsertColumn( 0, 'Location' ); my $btn = Wx::Button->new( $panel, # parent window -1, # ID 'Add Line', # label [ -1, -1 ], # default position [ -1, -1 ], # default size ); EVT_BUTTON( $self, $btn, sub { $self->add_line($idx); $idx++; } ); my $sizer = Wx::BoxSizer->new(&Wx::wxVERTICAL); $sizer->Add( $self->{list_ctrl}, 0, wxALL | wxEXPAND, 5 ); $sizer->Add( $btn, 0, wxALL | wxCENTER, 5 ); $panel->SetSizer($sizer); return $self; } # end sub new sub add_line { my ( $self, $idx ) = @_; my $line = "Line $idx"; $self->{list_ctrl}->InsertStringItem( $idx, $line ); return; } # end sub add_line package MyApp; use strict; use warnings; use base 'Wx::App'; sub OnInit { my $frame = MyForm->new; $frame->Show(1); } package main; my $app = MyApp->new; $app->MainLoop;

Regards, Stefan


In reply to Re: wxPerl fails with a cryptic message: "variable is not of type Wx::Point" by stefbv
in thread wxPerl fails with a cryptic message: "variable is not of type Wx::Point" by HelenCr

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.