From: Mark D. <mar...@zn...> - 2006-11-13 01:51:36
|
Tom, I've tested below on a Mac mini - 10.3, wx version 0.22. It works as desired. I think the problem with your code is you are using Wx qw( :all ); and you are not using 'strict'. Wx does not export ':all', but uses ':everything' instead. This would have been apparent if 'use strict' were switched on. Best regards Mark #------------ EXAMPLE ------------------------------------- package MyFrame; use strict; use Wx qw( :everything ); use vars qw(@ISA); @ISA = qw(Wx::Frame); sub new{ if(not exists $_[4]){ $_[4] = wxDefaultPosition;} if(not exists $_[5]){ $_[5] = wxDefaultSize;} my( $self ) = shift->SUPER::new( @_ ); $self->{panel} = Wx::Panel->new($self,-1,wxDefaultPosition,wxDefaultSize); $self->{txtCheck} = Wx::TextCtrl->new($self->{panel},-1,"",wxDefaultPosition,wxDefaultSize,wxTE_MULTILINE); $self->{txtCheck}->SetFont(Wx::Font->new(12,wxMODERN,wxNORMAL,wxNORMAL,0)); $self->{szVmain} = Wx::BoxSizer->new(wxVERTICAL); $self->{szVpanel} = Wx::BoxSizer->new(wxVERTICAL); $self->{szVmain}->Add($self->{panel},1,wxTOP|wxLEFT|wxBOTTOM|wxRIGHT|wxEXPAND,3); $self->{szVpanel}->Add($self->{txtCheck},1,wxTOP|wxLEFT|wxBOTTOM|wxRIGHT|wxEXPAND,3); $self->SetSizer($self->{szVmain}); $self->SetAutoLayout(1); $self->Layout(); $self->{panel}->SetSizer($self->{szVpanel}); $self->{panel}->SetAutoLayout(1); $self->{panel}->Layout(); $self->Refresh(); $self->Centre(); return $self; } package MyApp; use Wx; use base 'Wx::App'; use vars qw(@ISA ); @ISA = qw(Wx::App); sub OnInit { my( $self ) = shift; my( $frame ) = MyFrame->new(undef, -1); $frame->Show(1); return 1; } package main; my( $app ) = MyApp->new(); $app->MainLoop(); #------------ END EXAMPLE ------------------------------------- |