harryC has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,
I am new to wxPerl (never needed a GUI). I started of a piece of code of wx::Demo.
I am trying to add FlexGridsizers to pane's of a notebook but they always go to the first pane.
I am trying to get one in each pane. I do not see why it does not work. This is the piece of code that does not work.
$frame->{notebook_1_pane_1}->SetSizer($frame->{lov_sizer_1});
$frame->{notebook_1_pane_2}->SetSizer($frame->{AZ_sizer_1});
Below you can find the full code.
Anny idea's ? thanks for your help
Harry<\p>

#!/usr/bin/perl -w use strict; package main; use strict; use warnings; my $app = App->new(); $app->MainLoop; package App; use strict; use warnings; use base 'Wx::App'; sub OnInit { my $frame = Frame->new(); $frame->Show(1); } package Frame; use strict; use warnings; use Wx qw(:everything); use base qw(Wx::Frame); use Data::Dumper; sub new { my($self) = @_; $self = $self->SUPER::new(undef, -1, "Berekening - Voorbeeld +", wxDefaultPosition, wxDefaultSize,wxDEFAU +LT_FRAME_STYLE); $self = MenuBerekening->new($self); $self = ToolBerekening->new($self); # $self->{sizer_1} = Wx::BoxSizer->new(wxVERTICAL); $self = NotebookBoven->new($self); $self = NotebookOnder->new($self); $self->SetSizerAndFit( $self->{sizer_1} ); $self->Layout(); my $selfa = MyGridTableApp->new($self); return $self; } package MenuBerekening; use Wx qw[:everything]; use base qw(Wx::Frame); #use Data::Dumper; use strict; use Wx::Locale gettext => '_T'; sub new { my ($class, $frame) = @_; #my $grid = $class->SUPER::new($frame, wxID_ANY, wxDefaultPos +ition, # Grid object #Wx::Size->new(950,700)); $frame->{frame_menubar} = Wx::MenuBar->new(); my $tmp_menu; $tmp_menu = Wx::Menu->new(); $tmp_menu->Append(wxID_ANY, _T("Verwerk Assurcard Facturen"), + ""); $tmp_menu->Append(wxID_ANY, _T("Handmatig Inbrengen"), ""); $frame->{_T("frame_menubar")}->Append($tmp_menu, _T("Actie")) +; $frame->SetMenuBar($frame->{frame_menubar}); return ($class, $frame); } package ToolBerekening; use Wx qw[:everything]; use base qw(Wx::Frame); #use Data::Dumper use strict; use Wx::Locale gettext => '_T'; sub new { my ($class, $frame) = @_; $frame->{frame_toolbar} = Wx::ToolBar->new($frame, -1, wxDefa +ultPosition, wxDefaultSize, ); $frame->SetToolBar($frame->{frame_toolbar}); $frame->{frame_toolbar}->AddTool(wxID_ANY, _T("Naar Agresso s +turen"), Wx::Bitmap->new("P:\\OGV\\ASSURCARD_PROG\\bitmap\\opslaan.bm +p", wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _T("Naar Agresso +"), ""); $frame->{frame_toolbar}->AddTool(wxID_ANY, _T("Volgende"), Wx +::Bitmap->new("P:\\OGV\\ASSURCARD_PROG\\bitmap\\volgende.bmp", wxBITM +AP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _T("Volgende"), ""); $frame->{frame_toolbar}->Realize(); return ($class, $frame); } package NotebookBoven; use Wx qw[:everything]; use base qw(Wx::Frame); #use Data::Dumper use strict; use Wx::Locale gettext => '_T'; sub new { my ($class, $frame) = @_; $frame->{notebook_1} = Wx::Notebook->new($frame, wxID_ANY, wx +DefaultPosition, wxDefaultSize, 0); $frame->{notebook_1_pane_1} = Wx::Panel->new($frame->{noteboo +k_1}, wxID_ANY, wxDefaultPosition, wxDefaultSize, ); $frame->{notebook_1_pane_2} = Wx::Panel->new($frame->{noteboo +k_1}, wxID_ANY, wxDefaultPosition, wxDefaultSize, ); $frame->{notebook_1_pane_3} = Wx::Panel->new($frame->{noteboo +k_1}, wxID_ANY, wxDefaultPosition, wxDefaultSize, ); $frame->{notebook_1_pane_4} = Wx::Panel->new($frame->{noteboo +k_1}, wxID_ANY, wxDefaultPosition, wxDefaultSize, ); $frame->{notebook_1}->AddPage($frame->{notebook_1_pane_1}, _T +("Lid, Opname, Verzekering")); $frame->{notebook_1}->AddPage($frame->{notebook_1_pane_2}, _T +("Assurcard, Ziekenfonds")); $frame->{notebook_1}->AddPage($frame->{notebook_1_pane_3}, _T +("Bestaande Aandoening")); $frame->{notebook_1}->AddPage($frame->{notebook_1_pane_4}, _T +("Ernstige Ziekte")); $frame = Lid_Opname_Verzekering->new($frame); $frame = Assurcard_Ziekenfonds->new($frame); $frame->{notebook_1}->SetBackgroundColour(Wx::Colour->new(239 +, 243, 255)); $frame->{notebook_1_pane_1}->SetSizer($frame->{lov_sizer_1}); $frame->{notebook_1_pane_2}->SetSizer($frame->{AZ_sizer_1}); $frame->{sizer_1}->Add($frame->{notebook_1}, 1, wxEXPAND, 0); return ($class, $frame); } package Lid_Opname_Verzekering; use Wx qw[:everything]; use base qw(Wx::Frame); #use Data::Dumper use strict; use Wx::Locale gettext => '_T'; sub new { my ($class, $frame) = @_; $frame->{lov_sizer_1} = Wx::FlexGridSizer->new(4, 9, 10, 10); $frame->{lov_label_1} = Wx::Button->new($frame->{notebook_1_ +pane_1}, -1, _T("Agresso Nummer:"),wxDefaultPosition,wxSIZE(100,20)); $frame->{lov_label_2} = Wx::TextCtrl->new($frame->{notebook_ +1_pane_1}, -1, _T("\$Agresso_nummer"),wxDefaultPosition,wxSIZE(300,20 +)); $frame->{lov_label_3} = Wx::Button->new($frame->{notebook_1_ +pane_1}, -1, _T("Naam:"), wxDefaultPosition,wxSIZE(100,20)); $frame->{lov_label_4} = Wx::TextCtrl->new($frame->{notebook_ +1_pane_1}, -1, _T("\$naam"), wxDefaultPosition,wxSIZE(300,20)); $frame->{lov_label_5} = Wx::Button->new($frame->{notebook_1_ +pane_1}, -1, _T("Voornaam:"),wxDefaultPosition,wxSIZE(100,20)); $frame->{lov_label_6} = Wx::TextCtrl->new($frame->{notebook_ +1_pane_1}, -1, _T("\$voornaam"),wxDefaultPosition,wxSIZE(300,20)); $frame->{lov_label_7} = Wx::Button->new($frame->{notebook_1_ +pane_1}, -1, _T("Rijksreg. Nr."),wxDefaultPosition,wxSIZE(100,20)); $frame->{lov_label_8} = Wx::TextCtrl->new($frame->{notebook_ +1_pane_1}, -1, _T("\$Rijksreg_Nr"),wxDefaultPosition,wxSIZE(300,20)); $frame->{lov_label_9} = Wx::Button->new($frame->{notebook_1_ +pane_1}, -1, _T("Begin opname"),wxDefaultPosition,wxSIZE(100,20)); $frame->{lov_label_10} = Wx::TextCtrl->new($frame->{notebook +_1_pane_1}, -1, _T("\$Begin_opname"),wxDefaultPosition,wxSIZE(300,20) +); $frame->{lov_label_11} = Wx::Button->new($frame->{notebook_1 +_pane_1}, -1, _T("Eind opname"),wxDefaultPosition,wxSIZE(100,20)); $frame->{lov_label_12} = Wx::TextCtrl->new($frame->{notebook +_1_pane_1}, -1, _T("\$Eind_opname"),wxDefaultPosition,wxSIZE(300,20)) +; $frame->{lov_label_13} = Wx::Button->new($frame->{notebook_1 +_pane_1}, -1, _T("Verzekering"),wxDefaultPosition,wxSIZE(200,20)); $frame->{lov_label_14} = Wx::Button->new($frame->{notebook_1 +_pane_1}, -1, _T("Begin"),wxDefaultPosition,wxSIZE(100,20)); $frame->{lov_label_15} = Wx::Button->new($frame->{notebook_1 +_pane_1}, -1, _T("Eind"),wxDefaultPosition,wxSIZE(100,20)); $frame->{lov_label_16} = Wx::TextCtrl->new($frame->{notebook +_1_pane_1}, -1, _T("\$Verzekering1"),wxDefaultPosition,wxSIZE(200,20) +); $frame->{lov_label_17} = Wx::TextCtrl->new($frame->{notebook +_1_pane_1}, -1, _T("\$Begin1"),wxDefaultPosition,wxSIZE(100,20)); $frame->{lov_label_18} = Wx::TextCtrl->new($frame->{notebook +_1_pane_1}, -1, _T("\$Eind1"),wxDefaultPosition,wxSIZE(100,20)); $frame->{lov_label_19} = Wx::TextCtrl->new($frame->{notebook +_1_pane_1}, -1, _T("\$Verzekering2"),wxDefaultPosition,wxSIZE(200,20) +); $frame->{lov_label_20} = Wx::TextCtrl->new($frame->{notebook +_1_pane_1}, -1, _T("\$Begin2"),wxDefaultPosition,wxSIZE(100,20)); $frame->{lov_label_21} = Wx::TextCtrl->new($frame->{notebook +_1_pane_1}, -1, _T("\$Eind2"),wxDefaultPosition,wxSIZE(100,20)); $frame->{lov_label_22} = Wx::TextCtrl->new($frame->{notebook +_1_pane_1}, -1, _T("\$Verzekering3"),wxDefaultPosition,wxSIZE(200,20) +); $frame->{lov_label_23} = Wx::TextCtrl->new($frame->{notebook +_1_pane_1}, -1, _T("\$Begin3"),wxDefaultPosition,wxSIZE(100,20)); $frame->{lov_label_24} = Wx::TextCtrl->new($frame->{notebook +_1_pane_1}, -1, _T("\$Eind3"),wxDefaultPosition,wxSIZE(100,20)); #Rij1 #kolom 1 +2 $frame->{lov_panel_1} = Wx::Panel->new($frame->{notebook_1_pa +ne_1},-1,wxDefaultPosition,wxSIZE(20,20)); $frame->{lov_sizer_1}->Add($frame->{lov_label_1}, 0, wxALIGN_ +BOTTOM|wxALIGN_RIGHT); $frame->{lov_sizer_1}->Add($frame->{lov_label_2}, 0, wxALIGN_ +BOTTOM|wxALIGN_RIGHT); #kolom 3 + 4 + 5 3=spacer $frame->{lov_sizer_1}->Add($frame->{lov_panel_1}, 0, wxALIGN_ +BOTTOM|wxALIGN_RIGHT); $frame->{lov_sizer_1}->Add($frame->{lov_label_7}, 0, wxALIGN_ +BOTTOM|wxALIGN_RIGHT); $frame->{lov_sizer_1}->Add($frame->{lov_label_8}, 0, wxALIGN_ +BOTTOM|wxALIGN_RIGHT); #kolom 6 +7 +8 + 9 6 =spacer $frame->{lov_sizer_1}->Add($frame->{lov_panel_1}, 0, wxALIGN_ +BOTTOM|wxALIGN_RIGHT); $frame->{lov_sizer_1}->Add($frame->{lov_label_13}, 0, wxALIGN +_BOTTOM|wxALIGN_RIGHT); $frame->{lov_sizer_1}->Add($frame->{lov_label_14}, 0, wxALIGN +_BOTTOM|wxALIGN_RIGHT); $frame->{lov_sizer_1}->Add($frame->{lov_label_15}, 0, wxALIGN +_BOTTOM|wxALIGN_RIGHT); #Rij2 #kolom 1 +2 $frame->{lov_sizer_1}->Add($frame->{lov_label_3}, 0, wxALIGN_ +BOTTOM|wxALIGN_RIGHT); $frame->{lov_sizer_1}->Add($frame->{lov_label_4}, 0, wxALIGN_ +BOTTOM|wxALIGN_RIGHT); #kolom 3 + 4 + 5 3=spacer $frame->{lov_sizer_1}->Add($frame->{lov_panel_1}, 0, wxALIGN_ +BOTTOM|wxALIGN_RIGHT); $frame->{lov_sizer_1}->Add($frame->{lov_label_9}, 0, wxALIGN_ +BOTTOM|wxALIGN_RIGHT); $frame->{lov_sizer_1}->Add($frame->{lov_label_10}, 0, wxALIGN +_BOTTOM|wxALIGN_RIGHT); #kolom 6 +7 +8 + 9 6 =spacer $frame->{lov_sizer_1}->Add($frame->{lov_panel_1}, 0, wxALIGN_ +BOTTOM|wxALIGN_RIGHT); $frame->{lov_sizer_1}->Add($frame->{lov_label_16}, 0, wxALIGN +_BOTTOM|wxALIGN_RIGHT); $frame->{lov_sizer_1}->Add($frame->{lov_label_17}, 0, wxALIGN +_BOTTOM|wxALIGN_RIGHT); $frame->{lov_sizer_1}->Add($frame->{lov_label_18}, 0, wxALIGN +_BOTTOM|wxALIGN_RIGHT); #Rij 3 #kolom 1 +2 $frame->{lov_sizer_1}->Add($frame->{lov_label_5}, 0, wxALIGN_ +BOTTOM|wxALIGN_RIGHT); $frame->{lov_sizer_1}->Add($frame->{lov_label_6}, 0, wxALIGN_ +BOTTOM|wxALIGN_RIGHT); #kolom 3 + 4 + 5 3=spacer $frame->{lov_sizer_1}->Add($frame->{lov_panel_1}, 0, wxALIGN_ +BOTTOM|wxALIGN_RIGHT); $frame->{lov_sizer_1}->Add($frame->{lov_label_11}, 0, wxALIGN +_BOTTOM|wxALIGN_RIGHT); $frame->{lov_sizer_1}->Add($frame->{lov_label_12}, 0, wxALIGN +_BOTTOM|wxALIGN_RIGHT); #kolom 6 +7 +8 + 9 6 =spacer $frame->{lov_sizer_1}->Add($frame->{lov_panel_1}, 0, wxALIGN_ +BOTTOM|wxALIGN_RIGHT); $frame->{lov_sizer_1}->Add($frame->{lov_label_19}, 0, wxALIGN +_BOTTOM|wxALIGN_RIGHT); $frame->{lov_sizer_1}->Add($frame->{lov_label_20}, 0, wxALIGN +_BOTTOM|wxALIGN_RIGHT); $frame->{lov_sizer_1}->Add($frame->{lov_label_21}, 0, wxALIGN +_BOTTOM|wxALIGN_RIGHT); #Rij4 #kolom 1 +2 $frame->{lov_sizer_1}->Add($frame->{lov_panel_1}, 0, wxALIGN_ +BOTTOM|wxALIGN_RIGHT); $frame->{lov_sizer_1}->Add($frame->{lov_panel_1}, 0, wxALIGN_ +BOTTOM|wxALIGN_RIGHT); #kolom 3 +4 +5 $frame->{lov_sizer_1}->Add($frame->{lov_panel_1}, 0, wxALIGN_ +BOTTOM|wxALIGN_RIGHT); $frame->{lov_sizer_1}->Add($frame->{lov_panel_1}, 0, wxALIGN_ +BOTTOM|wxALIGN_RIGHT); $frame->{lov_sizer_1}->Add($frame->{lov_panel_1}, 0, wxALIGN_ +BOTTOM|wxALIGN_RIGHT); #kolom 6 +7 +8 + 9 6 =spacer $frame->{lov_sizer_1}->Add($frame->{lov_panel_1}, 0, wxALIGN_ +BOTTOM|wxALIGN_RIGHT); $frame->{lov_sizer_1}->Add($frame->{lov_label_22}, 0, wxALIGN +_BOTTOM|wxALIGN_RIGHT); $frame->{lov_sizer_1}->Add($frame->{lov_label_23}, 0, wxALIGN +_BOTTOM|wxALIGN_RIGHT); $frame->{lov_sizer_1}->Add($frame->{lov_label_24}, 0, wxALIGN +_BOTTOM|wxALIGN_RIGHT); #$frame->SetSizerAndFit( $frame->{lov_sizer_1} ); return ($class, $frame); } package Assurcard_Ziekenfonds; use Wx qw[:everything]; use base qw(Wx::Frame); #use Data::Dumper use strict; use Wx::Locale gettext => '_T'; sub new { my ($class, $frame) = @_; $frame->{AZ_sizer_1} = Wx::FlexGridSizer->new(4, 5, 10, 10); $frame->{AZ_label_1} = Wx::Button->new($frame->{notebook_1_p +ane_1}, -1, _T("Assurcard Nummer"),wxDefaultPosition,wxSIZE(100,20)); $frame->{AZ_label_2} = Wx::TextCtrl->new($frame->{notebook_1 +_pane_1}, -1, _T("\$AZ_Assurcard_nummer"),wxDefaultPosition,wxSIZE(30 +0,20)); $frame->{AZ_label_3} = Wx::Button->new($frame->{notebook_1_p +ane_1}, -1, _T("Status Kaart"), wxDefaultPosition,wxSIZE(100,20)); $frame->{AZ_label_4} = Wx::TextCtrl->new($frame->{notebook_1 +_pane_1}, -1, _T("\$AZ_Status_Kaart"), wxDefaultPosition,wxSIZE(300,2 +0)); $frame->{AZ_label_5} = Wx::Button->new($frame->{notebook_1_p +ane_1}, -1, _T("Begin Dat."),wxDefaultPosition,wxSIZE(100,20)); $frame->{AZ_label_6} = Wx::TextCtrl->new($frame->{notebook_1 +_pane_1}, -1, _T("\$AZ_Begin_Dat."),wxDefaultPosition,wxSIZE(300,20)) +; $frame->{AZ_label_7} = Wx::Button->new($frame->{notebook_1_p +ane_1}, -1, _T("Eind Dat."),wxDefaultPosition,wxSIZE(100,20)); $frame->{AZ_label_8} = Wx::TextCtrl->new($frame->{notebook_1 +_pane_1}, -1, _T("\$AZ_Eind_Dat."),wxDefaultPosition,wxSIZE(300,20)); $frame->{AZ_label_9} = Wx::Button->new($frame->{notebook_1_p +ane_1}, -1, _T("Ziekenfonds"),wxDefaultPosition,wxSIZE(100,20)); $frame->{AZ_label_10} = Wx::TextCtrl->new($frame->{notebook_ +1_pane_1}, -1, _T("\$AZ_Ziekenfonds"),wxDefaultPosition,wxSIZE(300,20 +)); $frame->{AZ_label_11} = Wx::Button->new($frame->{notebook_1_ +pane_1}, -1, _T("Extern Nr."),wxDefaultPosition,wxSIZE(100,20)); $frame->{AZ_label_12} = Wx::TextCtrl->new($frame->{notebook_ +1_pane_1}, -1, _T("\$AZ_Extern_nr"),wxDefaultPosition,wxSIZE(300,20)) +; #Rij1 #kolom 1 +2 $frame->{AZ_panel_1} = Wx::Panel->new($frame->{notebook_1_pan +e_1},-1,wxDefaultPosition,wxSIZE(20,20)); $frame->{AZ_sizer_1}->Add($frame->{AZ_label_1}, 0, wxALIGN_BO +TTOM|wxALIGN_RIGHT); $frame->{AZ_sizer_1}->Add($frame->{AZ_label_2}, 0, wxALIGN_BO +TTOM|wxALIGN_RIGHT); #kolom 3 + 4 + 5 3=spacer $frame->{AZ_sizer_1}->Add($frame->{AZ_panel_1}, 0, wxALIGN_BO +TTOM|wxALIGN_RIGHT); $frame->{AZ_sizer_1}->Add($frame->{AZ_label_3}, 0, wxALIGN_BO +TTOM|wxALIGN_RIGHT); $frame->{AZ_sizer_1}->Add($frame->{AZ_label_4}, 0, wxALIGN_BO +TTOM|wxALIGN_RIGHT); #Rij2 #kolom 1 +2 $frame->{AZ_sizer_1}->Add($frame->{AZ_label_5}, 0, wxALIGN_BO +TTOM|wxALIGN_RIGHT); $frame->{AZ_sizer_1}->Add($frame->{AZ_label_6}, 0, wxALIGN_BO +TTOM|wxALIGN_RIGHT); #kolom 3 + 4 + 5 3=spacer $frame->{AZ_sizer_1}->Add($frame->{AZ_panel_1}, 0, wxALIGN_BO +TTOM|wxALIGN_RIGHT); $frame->{AZ_sizer_1}->Add($frame->{AZ_label_9}, 0, wxALIGN_BO +TTOM|wxALIGN_RIGHT); $frame->{AZ_sizer_1}->Add($frame->{AZ_label_10}, 0, wxALIGN_B +OTTOM|wxALIGN_RIGHT); #Rij 3 #kolom 1 +2 $frame->{AZ_sizer_1}->Add($frame->{AZ_label_7}, 0, wxALIGN_BO +TTOM|wxALIGN_RIGHT); $frame->{AZ_sizer_1}->Add($frame->{AZ_label_8}, 0, wxALIGN_BO +TTOM|wxALIGN_RIGHT); #kolom 3 + 4 + 5 3=spacer $frame->{AZ_sizer_1}->Add($frame->{AZ_panel_1}, 0, wxALIGN_BO +TTOM|wxALIGN_RIGHT); $frame->{AZ_sizer_1}->Add($frame->{AZ_label_11}, 0, wxALIGN_B +OTTOM|wxALIGN_RIGHT); $frame->{AZ_sizer_1}->Add($frame->{AZ_label_12}, 0, wxALIGN_B +OTTOM|wxALIGN_RIGHT); #Rij4 #kolom 1 +2 $frame->{AZ_sizer_1}->Add($frame->{AZ_panel_1}, 0, wxALIGN_BO +TTOM|wxALIGN_RIGHT); $frame->{AZ_sizer_1}->Add($frame->{AZ_panel_1}, 0, wxALIGN_BO +TTOM|wxALIGN_RIGHT); #kolom 3 +4 +5 $frame->{AZ_sizer_1}->Add($frame->{AZ_panel_1}, 0, wxALIGN_BO +TTOM|wxALIGN_RIGHT); $frame->{AZ_sizer_1}->Add($frame->{AZ_panel_1}, 0, wxALIGN_BO +TTOM|wxALIGN_RIGHT); $frame->{AZ_sizer_1}->Add($frame->{AZ_panel_1}, 0, wxALIGN_BO +TTOM|wxALIGN_RIGHT); #$frame->SetSizerAndFit( $frame->{AZ_sizer_1} ); return ($class, $frame); } package NotebookOnder; use Wx qw[:everything]; use base qw(Wx::Frame); #use Data::Dumper use strict; use Wx::Locale gettext => '_T'; sub new { my ($class, $frame) = @_; $frame->{notebook_2} = Wx::Notebook->new($frame, wxID_ANY, wx +DefaultPosition, wxDefaultSize, 0); $frame->{notebook_2_pane_1} = Wx::Panel->new($frame->{noteboo +k_2}, wxID_ANY, wxDefaultPosition, wxDefaultSize, ); #$frame->{notebook_2_pane_1}->{sizer_1} = Wx::BoxSizer->new(w +xVERTICAL); $frame->{notebook_2_pane_2} = Wx::Panel->new($frame->{noteboo +k_2}, wxID_ANY, wxDefaultPosition, wxDefaultSize, ); $frame->{notebook_2}->AddPage($frame->{notebook_2_pane_1}, _T +("Overzicht")); $frame->{notebook_2}->AddPage($frame->{notebook_2_pane_2}, _T +("Assurcard")); $frame->{notebook_2}->SetBackgroundColour(Wx::Colour->new(239 +, 243, 255)); $frame->{sizer_1}->Add($frame->{notebook_2}, 1, wxEXPAND, 0); return ($class, $frame); } package MyGridTable; use strict; use warnings; use Wx qw(:everything); use Wx::Grid; use base qw(Wx::PlGridTable); use Data::Dumper; use Wx qw(wxRED wxGREEN); sub new { my( $class ) = @_; my $self = $class->SUPER::new; $self->{default} = Wx::GridCellAttr->new; # Cell attribute +s for demo purposes $self->{red_bg} = Wx::GridCellAttr->new; $self->{green_fg} = Wx::GridCellAttr->new; $self->{red_bg}->SetBackgroundColour( wxRED ); $self->{green_fg}->SetTextColour( wxGREEN ); return $self; } # Overridden Methods from the base class - these get modified/exp +anded in a real app sub GetNumberRows { 1000 } # Base demo is set for 100000 x 100 +000 sub GetNumberCols { 10 } sub IsEmptyCell { 0 } sub GetValue { my( $grid, $y, $x ) = @_; return "($y, $x)"; } sub SetValue { my( $grid, $x, $y, $value ) = @_; die "Read-Only table"; } sub GetTypeName { # Verified that swapping bool and double my( $grid, $r, $c ) = @_; # Swap the columns return $c == 0 ? 'double' : # Col 0 Boolean $c == 1 ? 'bool' : # Col 1 Double 'string'; # All others String } sub CanGetValueAs { my( $grid, $r, $c, $type ) = @_; return $c == 0 ? $type eq 'double' : $c == 1 ? $type eq 'bool' : $type eq 'string'; } sub GetValueAsBool { # Even rows false my( $grid, $r, $c ) = @_; # Odd rows true return $r % 2; } sub GetValueAsDouble { # Row # plus (Col #/1000) my( $grid, $r, $c ) = @_; return $r + $c / 1000; } sub GetAttr { # Cell attributes my( $grid, $row, $col, $kind ) = @_; return $grid->{default} if $row % 2 && $col % 2; # Odd row +s and odd cols default format return $grid->{red_bg} if $row % 2; # Odd rows only - red +background return $grid->{green_fg} if $col % 2; # Odd cols only - gr +een foreground text return Wx::GridCellAttr->new; # Even rows and even cols - +default format } sub SetColLabelValue { # Copied from the wiki for custom label +s my ($grid, $col, $value) = @_; $col = $grid->_checkCol($col); return unless defined $col; $$grid{coldata}->[$col]->{label} = $value; } sub GetColLabelValue { # Copied from the wiki for custom label +s my ($grid, $col) = @_; $col = $grid->_checkCol($col); return undef unless defined $col; return $$grid{coldata}->[$col]->{label}; } sub _checkCol { # Copied from the wiki for custom labels my ($grid, $col) = @_; my $cols = $grid->GetNumberCols; return undef unless defined $col && abs($col) < $cols; return $cols + $col if $col < 0; return $col; } sub SetRowLabelValue { # Modeled after the wiki for custom lab +els my ($grid, $row, $value) = @_; $row = $grid->_checkRow($row); return unless defined $row; $$grid{rowdata}->[$row]->{label} = $value; } sub GetRowLabelValue { # Modeled after the wiki for custom lab +els my ($grid, $row) = @_; $row = $grid->_checkRow($row); return undef unless defined $row; return $$grid{rowdata}->[$row]->{label}; } sub _checkRow { # Modeled after the wiki for custom labels my ($grid, $row) = @_; my $rows = $grid->GetNumberRows; return undef unless defined $row && abs($row) < $rows; return $rows + $row if $row < 0; return $row; } package MyGridTableApp; use strict; use warnings; use Wx qw(:everything); use base qw(Wx::Grid); use Data::Dumper; use Wx::Event qw(EVT_GRID_CELL_LEFT_CLICK EVT_GRID_CELL_RIGHT_CLI +CK EVT_GRID_CELL_LEFT_DCLICK EVT_GRID_CELL_RIGHT_DCLICK EVT_GRID_LABEL_LEFT_CLICK EVT_GRID_LABEL_RIGHT_CLICK EVT_GRID_LABEL_LEFT_DCLICK EVT_GRID_LABEL_RIGHT_DCLICK EVT_GRID_ROW_SIZE EVT_GRID_COL_SIZE EVT_GRID_RANGE_SELECT EVT_GRID_SELECT_CELL); # events changed names in version 2.9.x my $events29plus = ( defined(&Wx::Event::EVT_GRID_CELL_CHANGED) ) +; sub new { my ($class, $frame) = @_; my $grid = $class->SUPER::new($frame->{notebook_2_pane_1}, wx +ID_ANY, wxDefaultPosition, # Grid object Wx::Size->new(950,700)); my $sizer = $frame->{notebook_2_pane_1}->{sizer_1}; #my $grid =$frame->{grid_1} = Wx::Grid->new($frame->{notebook +_2_pane_1}, wxID_ANY); my $table = MyGridTable->new; # Virtual Table object #$sizer->Add( $grid, 1, wxEXPAND, 0); $grid->SetTable( $table ); #$sizer->Add($table, 1, wxEXPAND, 0); # Custom Grid Formatting Examples- text, fonts, colors, sizes +, gridlines - from Grid.pl $grid->SetLabelBackgroundColour(wxBLUE); $grid->SetLabelTextColour(Wx::Colour->new("yellow")); $grid->SetLabelFont(Wx::Font->new(14, wxFONTFAMILY_ROMAN, wx +NORMAL, wxBOLD)); $grid->SetColLabelSize(40); # Col height $grid->SetRowLabelSize(100); # Row height - 0 hides the ro +w labels $grid->SetDefaultColSize(120,1); # Default Cell width (Fit + overrides) $grid->SetDefaultRowSize(40,1); # Default Cell Height (Fit + overrides) $grid->EnableGridLines(1); # Grid lines 1-on, 0-off $grid->SetGridLineColour(wxBLUE); $grid->SetSelectionMode(wxGridSelectRows); # Always select + complete rows $grid->SetSelectionForeground(wxRED); $grid->SetSelectionBackground(wxGREEN); # Click within gri +d, background goes green # Click on row label, background stays black # until clicking within grid, then green(???) for my $c (0..$grid->GetNumberCols()-1) { # Column Header +Text my $cptr = $c+1; $grid->SetColLabelValue($c, "Col $cptr"); } for my $r (0..$grid->GetNumberRows()-1) { # Row Header Tex +t my $rptr = $r+1; $grid->SetRowLabelValue($r, "Row $rptr"); } # Sample Events - logs the events EVT_GRID_CELL_LEFT_CLICK( $grid, c_log_skip( "Cell left click +" ) ); EVT_GRID_CELL_RIGHT_CLICK( $grid, c_log_skip( "Cell right cl +ick" ) ); EVT_GRID_CELL_LEFT_DCLICK( $grid, c_log_skip( "Cell left doub +le click" ) ); EVT_GRID_CELL_RIGHT_DCLICK( $grid, c_log_skip( "Cell right do +uble click" ) ); EVT_GRID_LABEL_LEFT_CLICK( $grid, c_log_skip( "Label left cli +ck" ) ); EVT_GRID_LABEL_RIGHT_CLICK( $grid, c_log_skip( "Label right c +lick" ) ); EVT_GRID_LABEL_LEFT_DCLICK( $grid, c_log_skip( "Label left do +uble click" ) ); EVT_GRID_LABEL_RIGHT_DCLICK( $grid, c_log_skip( "Label right +double click" ) ); EVT_GRID_ROW_SIZE( $grid, sub { Wx::LogMessage( "%s %s", "Row size", GS2S( $_[1 +] ) ); $_[1]->Skip; } ); EVT_GRID_COL_SIZE( $grid, sub { Wx::LogMessage( "%s %s", "Col size", GS2S( $_[1 +] ) ); $_[1]->Skip; } ); EVT_GRID_RANGE_SELECT( $grid, sub { Wx::LogMessage( "Range %sselect (%d, %d, %d +, %d)", ( $_[1]->Selecting ? '' : ' +de' ), $_[1]->GetLeftCol, $_[1]->G +etTopRow, $_[1]->GetRightCol, $_[1]->GetBottomRow ); $_[0]->ShowSelections; $_[1]->Skip; } ); if( $events29plus ) { Wx::Event::EVT_GRID_CELL_CHANGED( $grid, c_log_skip( "Cel +l content changed" ) ); } else { Wx::Event::EVT_GRID_CELL_CHANGE( $grid, c_log_skip( "Cell + content changed" ) ); } EVT_GRID_SELECT_CELL( $grid, c_log_skip( "Cell select" ) ); return $grid; } sub ShowSelections { my $grid = shift; my @cells = $grid->GetSelectedCells; if( @cells ) { Wx::LogMessage( "Cells %s selected", join ', ', map { "(" . $_->GetC +ol . ", " . $_->Get +Row . ")" } @cells ); } else { Wx::LogMessage( "No cells selected" ); } my @tl = $grid->GetSelectionBlockTopLeft; my @br = $grid->GetSelectionBlockBottomRight; if( @tl && @br ) { Wx::LogMessage( "Blocks %s selected", join ', ', map { "(" . $tl[$_]->GetCol . ", " . $tl[$_]->GetRow . "-" . $br[$_]->GetCol . ", " . $br[$_]->GetRow . ")" } 0 .. $#tl ); } else { Wx::LogMessage( "No blocks selected" ); } my @rows = $grid->GetSelectedRows; if( @rows ) { Wx::LogMessage( "Rows %s selected", join ', ', @rows ); } else { Wx::LogMessage( "No rows selected" ); } my @cols = $grid->GetSelectedCols; if( @cols ) { Wx::LogMessage( "Columns %s selected", join ', ', @cols ) +; } else { Wx::LogMessage( "No columns selected" ); } } # pretty printer for Wx::GridEvent sub G2S { my $event = shift; my( $x, $y ) = ( $event->GetCol, $event->GetRow ); return "( $x, $y )"; } # prety printer for Wx::GridSizeEvent sub GS2S { my $event = shift; my $roc = $event->GetRowOrCol; return "( $roc )"; } # creates an anonymous sub that logs and skips any grid event sub c_log_skip { my $text = shift; return sub { Wx::LogMessage( "%s %s", $text, G2S( $_[1] ) ); $_[0]->ShowSelections; $_[1]->Skip; }; } 1;

Replies are listed 'Best First'.
Re: wxperl adding sizers to different Notebook Panels (variable names)
by Anonymous Monk on May 17, 2014 at 09:38 UTC

    I am trying to add FlexGridsizers to pane's of a notebook but they always go to the first pane. ... too many _1 _2 _3

    See Re: wxPerl: Wx::DatePickerCtrl crashes its sizer? where I say

    The two are not unrelated. Naming your variables mainsizer,sizer1,sizer2,button1... is not the best way to keep track of what's what, or what goes where, its easy to get confused

    One way of keeping track (what goes where) is naming your sizer/container elements by position, and incorporating the parent/child relationship into the name. Afterwards you incorporate your action elements (text/buttons) and name then by purpose/property/action (email_input/email_text,submit_button,cancel_button... )

    This naming problem extends to this

    $self = MenuBerekening->new($self); $self = ToolBerekening->new($self); $self = NotebookBoven->new($self); $self = NotebookOnder->new($self);

    along with most of your constructors returning two values

    Where your problem lies exactly? Its not worth hunting it down, start new file, one for each package, and start fixing the names, and never reuse $self

    Also see Re^3: wxPerl Static Text alignment