SET FORM SIZE

4D - Documentation   Français   English   German   Spanish   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next

version 2004


SET FORM SIZE ({object; }horizontal; vertical{; *})

ParameterTypeDescription
objectStringObject name indicating form limits
horizontalLongintIf * passed: horizontal margin (pixels)
If * omitted: width (pixels)
verticalLongintIf * passed: vertical margin (pixels)
If * omitted: height (pixels
** If passed: add margins defined by horizontal and
vertical parameters (automatic size or size based
on object, if object is passed)
If omitted: use horizontal and vertical as width and
height of the form

Description

The SET FORM 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:

Automatically — 4D determines the size of the form based on the notion that all objects must be visible — and possibly adding a horizontal and vertical margin,

On the place where a form object is found, where a horizontal and vertical margin may be added,

By entering "fixed" sizes (width and height).

For more information on resizing forms, refer to the 4D Design Reference manual.

Automatic size

If you want the size of the form to be set automatically, you must use the following syntax:

   SET FORM 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 size

If you want the form size to be based on an object, you must use the following syntax:

   SET FORM 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.

Fixed size

In you want to have a fixed form size, you must use the following syntax:

   SET FORM SIZE(horizontal; vertical)

In this case, you must pass the width and height (in pixels) of the form in horizontal and vertical.

The SET FORM 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.

Example

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";Standard 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=On load)
      C_BOOLEAN(b1;<>collapsed)
      C_LONGINT(margin)
      margin:=15
      b1:=<>collapsed
      If (<>collapsed)
         SET FORM HORIZONTAL RESIZING(False)
         SET FORM SIZE("b1";margin;margin)
      Else 
         SET FORM HORIZONTAL RESIZING(True)
         SET FORM SIZE("tab";margin;margin)
      End if 

   : (Form event=On click)
      <>collapsed:=b1
      If (b1)
            `collapsed
         GET OBJECT RECT(*;"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
         GET OBJECT RECT(*;"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)
         SET FORM HORIZONTAL RESIZING(True)
         SET FORM SIZE("tab";margin;margin)
      End if

   End case

See Also

SET FORM HORIZONTAL RESIZING, SET FORM VERTICAL RESIZING.


4D - Documentation   Français   English   German   Spanish   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next