Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2016-10-23 12:32 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (301 votes). Check out past polls.