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

I'm trying to figure out why my ActiveX::IE browser won't default to the size of my notebook tab. I can set the size but unfortunately it won't resize if I change the size of my test app. I've posted my test code below:
package MyApp; use strict; use utf8; use base qw( Wx::App ); use Wx ':everything'; use Wx::Event ':everything'; sub OnInit { my($this) = @_; my($frame) = MyFrame->new( undef, -1, "IE Test" ); $frame->CenterOnScreen; $frame->Show(1); $frame->SetIcon( Wx::GetWxPerlIcon() ); $this->SetTopWindow( $frame ); return 1; } package MyFrame; use Wx qw[:everything]; use Wx::Event qw[:everything]; use Wx::ActiveX::IE qw[:iexplorer]; use base qw(Wx::Frame); use strict; sub new { my( $class ) = shift; my( $self ) = $class->SUPER::new( @_ ); $self->{notebook_1} = Wx::Notebook->new($self, -1, wxDefaultPositi +on, wxDefaultSize, 0); $self->{notebook_1_pane_1} = Wx::Panel->new($self->{notebook_1}, - +1, wxDefaultPosition, [500, 300], ); $self->{notebook_1_pane_2} = Wx::Panel->new($self->{notebook_1}, - +1, wxDefaultPosition, wxDefaultSize, ); $self->{sizer_1} = Wx::BoxSizer->new(wxVERTICAL); $self->{notebook_1}->AddPage($self->{notebook_1_pane_1}, "Tab1"); $self->{notebook_1}->AddPage($self->{notebook_1_pane_2}, "Tab2"); $self->{sizer_1}->Add($self->{notebook_1}, 1, wxEXPAND, 0); $self->SetSizer($self->{sizer_1}); $self->{sizer_1}->Fit($self); $self->Layout(); my $browser = Wx::ActiveX::IE->new( $self->{notebook_1_pane_1} , - +1 , wxDefaultPosition , wxDefaultSize ); #my $browser = Wx::ActiveX::IE->new( $self->{notebook_1_pane_1} , +-1 , wxDefaultPosition , [500, 300] ); $browser->LoadUrl("http://www.google.com"); return $self; } 1; package main; my($app) = MyApp->new(); $app->MainLoop();
Does anyone see what I'm missing?

Replies are listed 'Best First'.
Re: wxPerl and ActiveX
by Anonymous Monk on Dec 05, 2008 at 20:55 UTC
    Try
    $self->{sizer_1}->Add($self->{notebook_1}, 1, wxEXPAND, 1)
      You have to set a sizer for the notebook pane, something like
      $self->{sizer_browser} = Wx::BoxSizer->new(wxVERTICAL); $self->{sizer_browser} ->Add( $browser, 1, wxEXPAND, 0); $self->{notebook_1_pane_1}->SetSizer($self->{sizer_browser}); $self->SetSizer($self->{sizer_1}); $self->{sizer_1}->Fit($self); $self->Layout();
      Its easiest to lay it out in wxglade