In regards to my earlier node I've done a little more research and it seems XRC is the way to go. Using WxGlade I've come up with my example I was talking about earlier:

use Wx; use Wx::XRC; package MyPanel; use base 'Wx::Panel'; sub new { my $class = shift; my $self = $class->SUPER::new(); $self->OnInit(@_); return $self; } sub OnInit { my $self = shift; my $parent = shift; my $xrc = shift; $xrc->LoadPanel($parent, 'panel_1'); return $self; } ################################################# # # package MyApp; # # ################################################# use strict; use vars qw(@ISA); @ISA = qw(Wx::App); sub OnInit { my($this) = @_; my($frame) = MyFrame->new( undef, -1, "Test"); $frame->SetSize(Wx::Size->new(640, 480)); $frame->CenterOnScreen; $frame->Show(1); $frame->SetIcon( Wx::GetWxPerlIcon() ); $this->SetTopWindow($frame); return 1; } ################################################# # # package MyFrame; # # ################################################# use strict; use vars qw(@ISA); use Wx::Html; @ISA = qw(Wx::Frame); use Wx qw(:everything); use Wx::Event qw(:everything); sub new { my( $class ) = shift; my( $this ) = $class->SUPER::new( @_ ); # Splitter $this->{main_splitter} = Wx::SplitterWindow->new($this, -1, wxDefa +ultPosition, wxDefaultSize, wxSP_NOBORDER ); # Minimum size for the framework of the html list box $this->{main_splitter}->SetMinimumPaneSize(175); $this->{listbox_pane} = Wx::Panel->new($this->{main_splitter}, -1, + wxDefaultPosition, wxDefaultSize, ); $this->{html_list} = Wx::SimpleHtmlListBox->new($this->{listbox_pa +ne}, -1, wxDefaultPosition, wxDefaultSize, [], wxSIMPLE_BORDER ); $this->{html_list}->SetBackgroundColour(Wx::Colour->new(255,255,25 +5)); $this->{html_list}->Append( 'Notebook_1' ); $this->{html_list}->Append( 'Notebook_2' ); EVT_LISTBOX( $this, $this->{html_list}, \&OnModuleClick ); $this->{notebook_pane} = Wx::Panel->new($this->{main_splitter}, -1 +, wxDefaultPosition, wxDefaultSize, ); $this->__do_layout(); return $this; } sub __do_layout { my $self = shift; $self->{main_sizer} = Wx::BoxSizer->new(wxHORIZONTAL); $self->{notebook_sizer} = Wx::GridSizer->new(1, 1, 0, 0); $self->{listbox_sizer}= Wx::FlexGridSizer->new(1, 1, 10, 10); $self->{listbox_sizer}->Add($self->{html_list}, 0, wxEXPAND, 0); $self->{listbox_pane}->SetSizer($self->{listbox_sizer}); $self->{listbox_sizer}->AddGrowableRow(0); $self->{listbox_sizer}->AddGrowableCol(0); $self->{notebook_pane}->SetSizer($self->{notebook_sizer}); $self->{main_splitter}->SplitVertically($self->{listbox_pane}, $se +lf->{notebook_pane}, 200 ); $self->{main_sizer}->Add($self->{main_splitter}, 1, wxEXPAND, 0); $self->SetSizer($self->{main_sizer}); $self->{main_sizer}->Fit($self); $self->Layout(); } sub OnModuleClick { my( $self, $event ) = @_; my $cursor=Wx::BusyCursor->new(); if ( $self->{html_list}->GetString( $event->GetInt ) eq 'Notebook_ +1') { $self->{xrc} = Wx::XmlResource->new(); $self->{xrc}->InitAllHandlers(); $self->{xrc}->Load('notebook1.xrc'); $self->{panel} = MyPanel->new($self->{notebook_pane}, $self->{xrc} +); } else { $self->{xrc} = Wx::XmlResource->new(); $self->{xrc}->InitAllHandlers(); $self->{xrc}->Load('notebook2.xrc'); $self->{panel} = MyPanel->new($self->{notebook_pane}, $self->{xrc} +); } undef $cursor; } package main; my($app) = MyApp->new(); $app->MainLoop();

the two xrc files mentioned:

# notebook1.xrc <?xml version="1.0" encoding="UTF-8"?> <!-- generated by wxGlade 0.4.1 on Wed Nov 1 13:21:42 2006 --> <resource version="2.3.0.1"> <object class="wxPanel" name="panel_1"> <style>wxTAB_TRAVERSAL|wxFULL_REPAINT_ON_RESIZE</style> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> <option>1</option> <flag>wxEXPAND</flag> <object class="wxNotebook" name="notebook_1"> <usenotebooksizer>1</usenotebooksizer> <object class="notebookpage"> <label>Notebook 1</label> <object class="wxPanel" name="notebook_1_pane_1"> <style>wxTAB_TRAVERSAL</style> <object class="wxFlexGridSizer"> <hgap>0</hgap> <growablerows>0</growablerows> <rows>2</rows> <growablecols>0</growablecols> <cols>1</cols> <vgap>0</vgap> <object class="sizeritem"> <option>1</option> <flag>wxEXPAND</flag> <object class="wxStaticBoxSizer"> <orient>wxHORIZONTAL</orient> <label>Notebook 1 Box</label> </object> </object> <object class="sizeritem"> <option>1</option> <flag>wxEXPAND</flag> <object class="wxFlexGridSizer"> <hgap>0</hgap> <rows>1</rows> <growablecols>0,2</growablecols> <cols>3</cols> <vgap>0</vgap> <object class="sizeritem"> <flag>wxALIGN_RIGHT</flag> <object class="wxButton" name= +"button_1"> <label>button_1</label> </object> </object> <object class="spacer"> <size>75, 20</size> </object> <object class="sizeritem"> <object class="wxButton" name= +"button_2"> <label>button_2</label> </object> </object> </object> </object> </object> </object> </object> </object> </object> </object> </object> </resource> # notebook2.xrc <?xml version="1.0" encoding="UTF-8"?> <!-- generated by wxGlade 0.4.1 on Wed Nov 1 13:21:42 2006 --> <resource version="2.3.0.1"> <object class="wxPanel" name="panel_1"> <style>wxTAB_TRAVERSAL|wxFULL_REPAINT_ON_RESIZE</style> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> <option>1</option> <flag>wxEXPAND</flag> <object class="wxNotebook" name="notebook_1"> <usenotebooksizer>1</usenotebooksizer> <object class="notebookpage"> <label>Notebook 2</label> <object class="wxPanel" name="notebook_1_pane_1"> <style>wxTAB_TRAVERSAL</style> <object class="wxFlexGridSizer"> <hgap>0</hgap> <growablerows>0</growablerows> <rows>2</rows> <growablecols>0</growablecols> <cols>1</cols> <vgap>0</vgap> <object class="sizeritem"> <option>1</option> <flag>wxEXPAND</flag> <object class="wxStaticBoxSizer"> <orient>wxHORIZONTAL</orient> <label>Notebook 2</label> </object> </object> <object class="sizeritem"> <option>1</option> <flag>wxEXPAND</flag> <object class="wxFlexGridSizer"> <hgap>0</hgap> <rows>1</rows> <growablecols>0,2</growablecols> <cols>3</cols> <vgap>0</vgap> <object class="sizeritem"> <flag>wxALIGN_RIGHT</flag> <object class="wxButton" name= +"button_1"> <label>button_3</label> </object> </object> <object class="spacer"> <size>75, 20</size> </object> <object class="sizeritem"> <object class="wxButton" name= +"button_2"> <label>button_4</label> </object> </object> </object> </object> </object> </object> </object> </object> </object> </object> </object> </resource>

All seems well except I can't seem to figure out why my notebook widget generated via the XRC files arne't expanding to the full size of the panel located on the right side of the splitter window.

Can anyone tell me what I'm missing?

Thanks


In reply to WxPerl and XRC ? by Anonymous Monk

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.