4D v15.4

Open form window

  •  
 
4D v15.4
Open form window

Open form window 


 

Open form window ( {aTable ;} formName {; type {; hPos {; vPos {; *}}}} ) -> Function result 
Parameter Type   Description
aTable  Table in Table of the form or Default table, if omitted
formName  String in Name of the form
type  Longint in Window type
hPos  Longint in Horizontal position of the window
vPos  Longint in Vertical position of the window
Operator in Save current position and size of the window
Function result  WinRef in Window reference number

The Open form window command opens a new window using the size and resizing properties of the form formName.

Note that formName is not displayed in the window. If you want to display the form, you have to call a command which loads a form (ADD RECORD for example).

By default (if the type parameter is not passed), a standard window with a close box is opened. Unlike the Open window command, no method is associated to the window's close box. Clicking on this close box cancels and closes the window, except if the On Close Box form event has been activated for the form. In this case, the code associated with the On Close Box event will be executed.

If formName is resizable, the window opened will contain a zoom box as well as a grow box.

Note: To know the main properties of a form, use the FORM GET PROPERTIES command.

The optional type parameter allows you to specify a type for the window. You must pass one of the following predefined constants (placed in the Open Form Window theme):

Constant Type Value
Form has full screen mode Mac Longint 65536
Modal form dialog box Longint 1
Movable form dialog box Longint 5
Palette form window Longint 1984
Plain form window Longint 8
Pop up form window Longint 32
Sheet form window Longint 33
Toolbar form window Longint 35

Notes:

  • The attributes (grow box, close box...) of the window created depend on the interface specifications of the operating system for the chosen type. It is therefore possible to obtain different results depending on the platform used.
  • The Form has full screen mode Mac constant must be added to one of the other type constants.
  • For more information about window types, refer to the Window Types (compatibility) section. Note that only the types listed in the Open Form Window theme can be used with the Open form window command.

When the Toolbar form window constant is passed, the window is created with the location, size and graphical properties of a toolbar, i.e.:

  • The window will always be displayed just under the menu bar.
  • The window's horizontal size will be automatically adjusted to fill all available horizontal space on the desktop (on OS X) or inside 4D's main window (on Windows). The window's vertical size is based on the form properties like all other form window types.
  • The window has no border, cannot be moved and cannot be resized manually, and hPos, vPos and * parameters are ignored if present.
  • It is not possible to create two different toolbar windows at the same time. If Open form window is called with the Toolbar form window type while a toolbar window already exists, an error -10613 ("Cannot create two form windows of type toolbar") is generated.

Toolbar form windows and OS X full screen mode: If your application displays both a toolbar window and standard windows that support full screen mode (Form has full screen mode Mac option), interface rules require that you hide the toolbar when a standard window enters full screen mode. To know if a window has switched to full screen mode, just test whether its vertical size is exactly the same as the screen's height (see the HIDE TOOL BAR command).

The optional parameter hPos allows you to define the horizontal position of the window. You can pass a defined position, expressed in points, to this parameter (refer to the Open window command) or one of the following predefined constants placed in the Open Form Window theme:

Constant Type Value
Horizontally centered Longint 65536
On the left Longint 131072
On the right Longint 196608

The optional parameter vPos allows you to define the vertical position of the window. You can pass a defined position, expressed in points, to this parameter (refer to the Open window command) or one of the following predefined constants placed in the Open Form Window theme:

Constant Type Value
At the bottom Longint 393216
At the top Longint 327680
Vertically centered Longint 262144

These parameters take into account the presence of the tool bar and menu bar as well as the current size of the application's window (on Windows).

If you pass the optional parameter *, the current position and size of the window are memorized when closed. When the window is reopened again, its previous position and size are respected. In this case, the vPos and hPos parameters are only used the first time the window is opened.

Note: To reopen a window at vPos and hPos initial coordinates when the * parameter is used, hold down the Shift key while the window is being opened. 

The following statement opens a standard window with a close box and automatically adjusts it to be the same size as the "Input" form. The form window size is not set to "fixed", then the window also has a grow and a zoom box:

 $winRef :=Open form window([Table1];"Enter")

The following statement opens a floating palette in the upper left portion of the screen based on a project form named "Tools". This palette uses the last position it was in when the user closed it each time it is reopened:

 $winRef :=Open form window("Tools";Palette form window;On the left;At the top;*)



See also 

FORM GET PROPERTIES
Open window
Window Types (compatibility)