HenryLaw has asked for the wisdom of the Perl Monks concerning the following question:
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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Centring text in a WxPerl static text box
by beech (Parson) on Feb 14, 2018 at 05:36 UTC | |
by HenryLaw (Acolyte) on Feb 14, 2018 at 08:41 UTC | |
by beech (Parson) on Feb 14, 2018 at 22:52 UTC | |
by HenryLaw (Acolyte) on Feb 14, 2018 at 19:24 UTC | |
|
Re: Centring text in a WxPerl static text box
by NetWallah (Canon) on Feb 14, 2018 at 03:00 UTC | |
by HenryLaw (Acolyte) on Feb 14, 2018 at 08:31 UTC |