This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20 R7
Open window
|
Open window ( left ; top ; right ; bottom {; type {; title {; controlMenuBox}}} ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
left | Longint |
![]() |
Global left coordinate of window contents area | |||||
top | Longint |
![]() |
Global top coordinate of window contents area | |||||
right | Longint |
![]() |
Global right coordinate of window contents area, or -1 for using form default size | |||||
bottom | Longint |
![]() |
Global bottom coordinate of window contents area, or -1 for using form default size | |||||
type | Longint |
![]() |
Window type | |||||
title | String |
![]() |
Title of window or "" for using default form title | |||||
controlMenuBox | String |
![]() |
Method to call when the Control-menu box is double-clicked or the Close box is clicked | |||||
Function result | WinRef |
![]() |
Window reference number | |||||
Open window opens a new window with the dimensions given by the first four parameters:
Compatibility note: Open window integrates various options which have evolved over the versions, and is now only kept for compatibility reasons. When you write new code for managing windows, we strongly recommend using the Open form window command, which is better suited to current interfaces.
If you pass -1 in both right and bottom, you instruct 4D to automatically size the window under the following conditions:
Important: This automatic sizing of the window will occur only if you made a prior call to FORM SET INPUT for the form to be displayed, and if you passed the * optional parameter to FORM SET INPUT.
If you pass an empty string ("") in title, you instruct 4D to use the Window Title set in the Design environment Form Properties window for the form to be displayed.
Important: The default form title will be set to the window only if you made a prior call to FORM SET INPUT for the form to be displayed, and if you passed the * optional parameter to FORM SET INPUT.
Note: You can also manage the closing of the window from within the form method of the form displayed in the window when an On Close Box event occurs. For more information, see the command Form event code.
If more than one window is open for a process, the last window opened is the active (frontmost) window for that process. Only information within the active window can be modified. Any other windows can be viewed. When the user types, the active window will always come to the front, if it is not already there.
Forms are displayed inside an open window. Text from the MESSAGE command also appears in the window.
Open window returns a WinRef type window reference, which can be used by window management commands (see the "WinRef" section).
The following project method opens a window centered in the main window (Windows) or in the main screen (Macintosh). Note that it can accept two, three, or four parameters:
` OPEN CENTERED WINDOW project method
` $1 – Window width
` $2 – Window height
` $3 – Window type (optional)
` $4 – Window title (optional)
$SW:=Screen width\2
$SH:=(Screen height\2)
$WW:=$1\2
$WH:=$2\2
Case of
:(Count parameters=2)
Open window($SW-$WW;$SH-$WH;$SW+$WW;$SH+$WH)
:(Count parameters=3)
Open window($SW-$WW;$SH-$WH;$SW+$WW;$SH+$WH;$3)
:(Count parameters=4)
Open window($SW-$WW;$SH-$WH;$SW+$WW;$SH+$WH;$3;$4)
End case
After the project method is written, you can use it this way:
OPEN CENTERED WINDOW(400;250;Movable dialog box;"Update Archives")
DIALOG([Utility Table];"UPDATE OPTIONS")
CLOSE WINDOW
If(OK=1)
` ...
End if
The following example opens a floating window that has a Control-menu box (Windows) or Close Box (Macintosh) method. The window is opened in the upper right hand corner of the application window.
$myWindow:=Open window(Screen width-149;33;Screen width-4;178;-Palette window;"";"CloseColorPalette")
DIALOG([Dialogs];"Color Palette")
The CloseColorPalette method calls the CANCEL command:
CANCEL
The following example opens a window whose size and title come from the properties of the form displayed in the window:
FORM SET INPUT([Customers];"Add Records";*)
$myWindow:=Open window(10;80;-1;-1;Plain window;"")
Repeat
ADD RECORD([Customers])
Until(OK=0)
Reminder: In order to have Open window automatically use the properties of the form, you must call FORM SET INPUT with the optional * parameter, and the properties of the form must have been set accordingly in the Design environment.
This example illustrates the “delay” mechanism for displaying sheet windows under Mac OS X:
$myWindow:=Open window(10;10;400;400;Sheet window)
`For the moment, the window is created but remains hidden
DIALOG([Table];"dialForm")
`The On Load event is generated then the sheet window is displayed; it "drops down" from the bottom
`of the title bar
Product: 4D
Theme: Windows
Number:
153
Modified: 4D 2004
4D Language Reference ( 4D v20 R7)