Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Centring text in a WxPerl static text box

by HenryLaw (Initiate)
on Feb 14, 2018 at 19:24 UTC ( #1209171=note: print w/replies, xml ) Need Help??


in reply to Re: Centring text in a WxPerl static text box
in thread Centring text in a WxPerl static text box

Spent most of the afternoon fiddling with this. I'm convinced that the wxALIGN_CENTRE flag doesn't work.

I've written a little subroutine which does what I want; it's OK but it shouldn't be necessary

sub centre_text{ # centre_text( $text_control, $container ); # Not enough error checking, really ... my ( $text_control, $container ) = @_; my ($container_width) = $container->GetSizeWH(); my ($text_width) = $container->GetTextExtent( $text_control->GetLabe +l() ); my ( $text_x, $text_y ) = $text_control->GetPositionXY(); $text_control->Move( ($container_width-$text_width)/2, $text_y ); }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1209171]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2018-07-21 12:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (448 votes). Check out past polls.

    Notices?