This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20.6
FORM SET SIZE
|
FORM SET SIZE ( {object ;} horizontal ; vertical {; *} ) | ||||||||
Parameter | Type | Description | ||||||
object | String |
![]() |
Object name indicating form limits | |||||
horizontal | Longint |
![]() |
If * passed: horizontal margin (pixels) If * omitted: width (pixels) |
|||||
vertical | Longint |
![]() |
If * passed: vertical margin (pixels) If * omitted: height (pixels) |
|||||
* | Operator |
![]() |
• If passed, use horizontal and vertical as form margins • If omitted, use horizontal and vertical as width and height of the form This parameter cannot be passed if the object parameter is passed. |
|||||
The FORM SET SIZE command allows you to change the size of the current form by programming. The new size is defined for the current process; it is not saved with the form.
As in the Design environment, you can use this command to set the form size in three ways:
If you want the size of the form to be set automatically, you must use the following syntax:
FORM SET SIZE(horizontal;vertical;*)
In this case, you must pass the margins (in pixels) that you want to add to the right and bottom of the form in horizontal and vertical.
Object-based sizeIf you want the form size to be based on an object, you must use the following syntax:
FORM SET SIZE(object;horizontal;vertical)
In this case, you must pass the margins (in pixels) that you want to add to the right and bottom of the object in horizontal and vertical. You cannot pass the * parameter.
Fixed sizeIn you want to have a fixed form size, you must use the following syntax:
FORM SET SIZE(horizontal;vertical)
In this case, you must pass the width and height (in pixels) of the form in horizontal and vertical.
The FORM SET SIZE command changes the size of the form, but also takes into account the resizing properties. For example, if the minimum width of a form is 500 pixels and if the command sets a width of 400 pixels, the new form width will be 500 pixels.
Also note that this command does not change the size of the form window (you can resize a form without changing the size of the window and vice versa). To change the size of the form window, refer to the RESIZE FORM WINDOW command.
The following example shows how an Explorer type window is set up. The following form is created in the Design environment :
The size of the form is “automatic”.
The window is displayed using the following code:
$ref:=Open form window([Table 1];"Form1";Plain form window;Horizontally centered;Vertically centered;*)
DIALOG([Table 1];"Form1")
CLOSE WINDOW
The right part of the window can be displayed or hidden by clicking on the increase/decrease option:
The object method associated with this button is as follows:
Case of
:(FORM Event.code=On Load)
C_BOOLEAN(b1;<>collapsed)
C_LONGINT(margin)
margin:=15
b1:=<>collapsed
If(<>collapsed)
FORM SET HORIZONTAL RESIZING(False)
FORM SET SIZE("b1";margin;margin)
Else
FORM SET HORIZONTAL RESIZING(True)
FORM SET SIZE("tab";margin;margin)
End if
:(FORM Event.code=On click)
<>collapsed:=b1
If(b1)
`collapsed
OBJECT GET COORDINATES(*;"b1";$l;$t;$r;$b)
GET WINDOW RECT($lf;$tf;$rf;$bf;Current form window)
SET WINDOW RECT($lf;$tf;$lf+$r+margin;$tf+$b+margin;Current form window)
SET FORM HORIZONTAL RESIZING(False)
SET FORM SIZE("b1";margin;margin)
Else
`expanded
OBJECT GET COORDINATES(*;"tab";$l;$t;$r;$b)
GET WINDOW RECT($lf;$tf;$rf;$bf;Current form window)
SET WINDOW RECT($lf;$tf;$lf+$r+margin;$tf+$b+margin;Current form window)
FORM SET HORIZONTAL RESIZING(True)
FORM SET SIZE("tab";margin;margin)
End if
End case
Product: 4D
Theme: Forms
Number:
891
Created: 4D 2004
Renamed: 4D v12 (SET FORM SIZE)
4D Language Reference ( 4D v20)
4D Language Reference ( 4D v20.1)
4D Language Reference ( 4D v20.2)
4D Language Reference ( 4D v20.3)
4D Language Reference ( 4D v20.4)
4D Language Reference ( 4D v20.5)
4D Language Reference ( 4D v20.6)