From: Daniell F. <win...@gm...> - 2005-09-23 13:04:12
|
Thanks for replying. Let me give more details. I have included all =20= of the references to the TextCtrl and which functions they belong to. sub new { my( $self, $parent, $id, $title, $pos, $size, $style, $name ) =3D = @_; $parent =3D undef unless defined $parent; $id =3D -1 unless defined $id; $title =3D "" unless defined $title; $pos =3D wxDefaultPosition unless defined $pos; $size =3D wxDefaultSize unless defined $size; $name =3D "" unless defined $name; # begin wxGlade: MyFrame1::new $style =3D wxDEFAULT_FRAME_STYLE unless defined $style; $self =3D $self->SUPER::new( $parent, $id, $title, $pos, $size, =20 $style, $name ); $self->{notebook_1} =3D Wx::Notebook->new($self, -1, =20 wxDefaultPosition, wxDefaultSize, 0); $self->{journal_apply_pane} =3D Wx::ScrolledWindow->new($self->=20 {notebook_1}, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL); $self->{panel_1} =3D Wx::Panel->new($self->{journal_apply_pane}, =20= -1, wxDefaultPosition, wxDefaultSize, ); $self->{journal_admin_pane} =3D Wx::Panel->new($self->=20 {notebook_1}, -1, wxDefaultPosition, wxDefaultSize, ); $self->{integrity_pane} =3D Wx::Panel->new($self->{notebook_1}, =20 -1, wxDefaultPosition, wxDefaultSize, ); $self->{general_pane} =3D Wx::Panel->new($self->{notebook_1}, -1, =20= wxDefaultPosition, wxDefaultSize, ); $self->{label_3} =3D Wx::StaticText->new($self->{general_pane}, =20 -1, "Email Address", wxDefaultPosition, wxDefaultSize, ); $self->{general_email_address} =3D Wx::TextCtrl->new($self->=20 {general_pane}, -1, "", wxDefaultPosition, wxDefaultSize, ); # other widget definitions $self->__set_properties(); $self->__do_layout(); } # end new sub __set_properties { my $self =3D shift; # begin wxGlade: MyFrame1::__set_properties $self->SetTitle("Epic Admin"); $self->SetSize(772, 517); $self->{general_email_address}->SetSize(200, 24); # other widgets.... } sub __do_layout { my $self =3D shift; # begin wxGlade: MyFrame1::__do_layout $self->{sizer_1} =3D Wx::BoxSizer->new(wxVERTICAL); $self->{sizer_2} =3D Wx::BoxSizer->new(wxHORIZONTAL); $self->{sizer_3} =3D Wx::FlexGridSizer->new(2, 1, 0, 0); $self->{sizer_4} =3D Wx::BoxSizer->new(wxHORIZONTAL); $self->{grid_sizer_3} =3D Wx::GridSizer->new(5, 2, 0, 20); $self->{grid_sizer_2} =3D Wx::GridSizer->new(9, 2, 1, 24); $self->{grid_sizer_1} =3D Wx::FlexGridSizer->new(12, 3, 0, 0); $self->{grid_sizer_1}->Add($self->{label_3}, 0, wxALIGN_RIGHT, 0); $self->{grid_sizer_1}->Add(50, 24, 0, 0, 0); $self->{grid_sizer_1}->Add($self->{general_email_address}, 0, 0, =20= 0); # other widgets } I've also attached the entire Perl module and the main.pl script for =20 reference. I really appreciate the help; I'm just trying to =20 understand how the widgets work. Thanks again, Dan Freed =EF=BF=BC=EF=BF=BC On Sep 23, 2005, at 3:22 AM, Johan Vromans wrote: > Daniell Freed <win...@gm...> writes: > > >> Basically the problem seems to be that I can't get my widgets to >> change size. If I edit the code that wxGlade gave me, I can create a >> Wx::Size() object, and change wxDefaultSize to my size object, and >> this will result with the correct size. For example, this doesn't >> seem to work (this is how wxGlade does it): >> >> $self->{text_ctrl_2} =3D Wx::TextCtrl->new($self->{general_pane}, -1, >> "", wxDefaultPosition, wxDefaultSize, ); >> $self->{text_ctrl_2}->SetSize(200,24) >> > > If this is wxGlade code, the constructor is in the 'new' method while > the SetSize is in '__set_properties' (called from within the > constructor). There could be code inbetween that defeats the size > settings. For example, when text_ctrl_2 is configured to stretch > to the size of the containing widget (sizer), setting the size later > will not change it. > > I cannot judge the details with so little information, but in general, > it is better to leave it to the sizers to size the widgets. > > HTH, > Johan > |