http://www.perlmonks.org?node_id=922796


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.