Open window

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next

version 2004 (Modified)


Open window (left; top; right; bottom{; type{; title{; controlMenuBox}}}){ WinRef }

ParameterTypeDescription
leftNumberGlobal left coordinate of window contents area
topNumberGlobal top coordinate of window contents area
rightNumberGlobal right coordinate of window contents area,
or -1 for using form default size
bottomNumberGlobal bottom coordinate of window contents area,
or -1 for using form default size
typeNumberWindow type
titleStringTitle of window
or "" for using default form title
controlMenuBoxStringMethod to call when the Control-menu box is
double-clicked or the Close box is clicked
Function resultWinRefWindow reference number

Description

Open window opens a new window with the dimensions given by the first four parameters:

left is the distance in pixels from the left edge of the application window to the left internal edge of the window.

top is the distance in pixels from the top of the application window to the top internal edge of the window.

right is the distance in pixels from the left edge of the application window to the right internal edge of the window.

bottom is the distance in pixels from the top of the application window to the bottom internal edge of the window.

If you pass -1 in both right and bottom, you instruct 4D to automatically size the window under the following conditions:

You have designed a form and set its Sizing Options in the Design environment Form properties window

Before calling Open window, you selected the form using the command INPUT FORM, to which you passed the optional * parameter.

Important: This automatic sizing of the window will occur only if you made a prior call to INPUT FORM for the form to be displayed, and if you passed the * optional parameter to INPUT FORM.

The type parameter is optional. It represents the type of window you want to display, and corresponds to the different windows shown in the section Window Types. If the window type is negative, the window created is a floating window. If the type is not specified, type 1 is used by default. The title parameter is the optional title for the window

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 INPUT FORM for the form to be displayed, and if you passed the * optional parameter to INPUT FORM.

The controlMenuBox parameter is the optional Control-menu box method for the window. If this parameter is specified, a Control-menu box (Windows) or a Close Box (Macintosh) is added to the window. When the user double-clicks the Control-menu box (Windows) or clicks on the Close Box (Macintosh), the method passed in controlMenuBox is called.

Version 6 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.

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.

Examples

1. 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

2. 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.

   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 

3. The following example opens a window whose size and title come from the properties of the form displayed in the window:

   INPUT FORM([Customers];"Add Records";*)
   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 INPUT FORM with the optional * parameter, and the properties of the form must have been set accordingly in the Design environment.

4. 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

See Also

CLOSE WINDOW, Open external window, Open form window.


4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next