Language Reference Guide : Events : WindowResized Event
 
Share this page          
WindowResized Event
The WindowResized event is triggered for a frame when the user resizes the window in which the frame is running with the window manager resize capabilities.
This event has the following syntax:
on windowresized
The following attributes of the FrameExec class can be used in the WindowResized event block:
InputFocusField
Specifies the field with current input focus
WindowWidth
Specifies the width of the window after it is resized
WindowHeight
Specifies the height of the window after it is resized
Use the CurFrame system variable to access these attributes. For more information, see FrameExec Class.
Usage: You can only specify this event in the frame script.
The WindowResized event lets you specify what should occur when the user resizes the frame's window. For example, if you have a frame that contains a single multiline entry field (testentry) that fills the window, you could use the following code to resize the field when a user resizes the window:
initialize(
    bottom_margin = integer,
    right_margin = integer) =
begin
    /* Use the top and left margins as the base
    ** for calculations after window resize
    */
    bottom_margin = field(testentry).YTop;
    right_margin = field(testentry).XLeft;
end
    ...
on windowresized =
begin
    /* Set the field INVISIBLE before changing the
    ** margins, and back to CHANGEABLE or the field
    ** will flicker as it changes first the height,
    ** repaints the field, sets the width, and then
    ** repaints it again.*/
    field(testentry).CurBias = FB_INVISIBLE;
    field(testentry).OuterHeight =
    CurFrame.WindowHeight-(2*bottom_margin);
    field(testentry).OuterWidth =
    CurFrame.WindowWidth-(2*right_margin);
    field(testentry).CurBias = FB_CHANGEABLE;
end
More information:
InputFocusField Attribute
WindowHeight Attribute
WindowWidth Attribute