14. Creating a Frame at Runtime : How You Can Build a Frame Dynamically : How You Can Create the FrameSource Object : How You Can Set the Form Height and Width
 
Share this page                  
How You Can Set the Form Height and Width
After all the fields have been constructed, you can set the dimensions of the window displaying the frame by setting the WindowHeight and WindowWidth attributes of the FrameSource object. The following code from the Go operation of the DynamicFrame frame sets these dimensions:
/* Now set the form height and width */
test_frame.WindowHeight = fieldtop + vertspace;
test_frame.WindowWidth = maxformwidth;
if test_frame.WindowHeight > maxformheight then
    test_frame.WindowHeight = maxformheight;
    test_frame.HasScrollbars = TRUE;
else
    test_frame.HasScrollbars = FALSE;
endif;
To prevent the window's height from exceeding a predetermined amount, the example code contains an if statement that checks the height. If it exceeds the limit (the value of the maxformheight variable), the WindowHeight attribute is set to the value of the maxformheight variable and scroll bars are added to the window, allowing the user to scroll to hidden fields. If the window's height does not exceed the limit, the scroll bars are not added.