144 Form design: Resize page and form at runtimeVERSIONS: All, written for Paradox 5
SUBJECT: Resize page and form at runtime
BY: RICHARD DAVIS
Question:
I have a base table frame of 5 columns, 4 of which may or may not be displayed based on user selection (in another form), and using the deletecolumn method. Each time the form is opened, the tableframe displays only those columns which should be included based on the user's selections in another area of the application.
The problem is that if, for example, only 2 out of four of these columns are displayed, the display form window does not resize in accordance with the size of the table frame as I would prefer it to.
Is it possible to resize a form's page (and/or the entire form window complete with controls) once it's canArrive method has deleted specific columns in a tableframe contained within it?
Try the below code in the Arrive method for the page:
dodefault
self.size = tableFrameName.size
self.container.sizetofit = True
The second line sets the size of the page to be the same as the tableframe. You may want to adjust this. In this case, size is a property of uiObjects, including the page, of type point. It refers to the lower right point of the object. In the third line, "Self.container" refers to the form. This sets the form's sizetofit property to true, which forces the form to resize to the new page size. You may want to open the form hidden first, then use bringToTop() to show it. (You only need to do this if you see a lot of flicker on the screen as the page and form resize.)