Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Scrolling text in a Win32:GUI window

by kejohm (Hermit)
on Aug 27, 2011 at 07:58 UTC ( #922796=note: print w/replies, xml ) Need Help??

in reply to Scrolling text in a Win32:GUI window

When creating a window, the size specified is for the whole window, which includes the border, titlebar, and minimize, maximize and close buttons (known as the non-client area). When creating a control using this size, it will be bigger than the area of the window used to display controls (known as the client area). You can use the ScaleWidth() and ScaleHeight() methods to get the size of the client area of the window. So in order to create a textfield that takes up all of the window, you can do something like this:

my $scalewidth = $Main->ScaleWidth(); my $scaleheight = $Main->ScaleHeight(); my $Main_msgs = $Main->AddTextfield( ... -size => [$scalewidth, $scaleheight], ... );

In order to make the textfield resize as the window does, you need to respond to the window Resize event. This involves creating a subroutine that will be called by Win32::GUI when the event is triggered. Here is an example:

# The sub is named for the control name and event name sub Main_Resize { my $scalewidth = $Main->ScaleWidth(); my $scaleheight = $Main->ScaleHeight(); $Main_msgs->Resize($scalewidth, $scaleheight); return 1; }

Replies are listed 'Best First'.
Re^2: Scrolling text in a Win32:GUI window
by alexanderp98 (Novice) on Aug 30, 2011 at 00:58 UTC

    Thanks for your help.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2018-03-18 22:15 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (231 votes). Check out past polls.