The following code, based on an example in http://learnperl.scratchcomputing.com/tutorials/wxperl/, is a minimum example which is supposed to put up a StaticText control with its legend centred. Instead it is resolutely left-aligned. I have tried everything I can think of, including putting wxALIGN_CENTRE on the sizer add, calling the CentreOnParent method of the text box ... and a dozen other things I can't remember.
What am I doing wrong?
#!/usr/bin/env perl use warnings; use strict; use Wx; use wxPerl::Constructors; package MyApp; use base 'Wx::App'; use Wx qw( wxALIGN_CENTRE wxVERTICAL wxEXPAND ); sub OnInit { my $self = shift; my $frame = wxPerl::Frame->new(undef, 'A wxPerl Application'); $frame->SetMinSize([120,40]); my $sizer = Wx::BoxSizer->new(wxVERTICAL); my $text = wxPerl::StaticText->new( $frame, "This is text", style => wxALIGN_CENTRE ); $sizer->Add( $text, 1, wxEXPAND ); $frame->SetSizer($sizer); $frame->Show; } MyApp->new->MainLoop;
In reply to Centring text in a WxPerl static text box by HenryLaw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |