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; }

In reply to Re: Scrolling text in a Win32:GUI window by kejohm
in thread Scrolling text in a Win32:GUI window by alexanderp98

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.