DISPLAY FLOATING WINDOW creates and displays a floating window.
DISPLAY FLOATING [GRAPHICAL] WINDOW [ UPON parent-window ]
Remaining phrases are optional, can appear in any order.
{MODELESS} {MODAL } {LINK} TO THREAD {BIND} SCREEN LINE NUMBER screen-line SCREEN {COLUMN } NUMBER screen-col {COL } {POSITION} {POS } AT screen-loc AT LINE NUMBER line-num AT {COLUMN } NUMBER col-num {COL } {POSITION} {POS } SIZE length LINES height FONT {IS} font-1 {= } CONTROL FONT {IS} font-3 {= } CELL {SIZE } [IS] {cell-units } {HEIGHT} [= ] {control-type-name FONT font-2 [SEPARATE ]} {WIDTH } {control-type-name FONT [OVERLAPPED]} {ERASE} SCREEN {BLANK} {REVERSE-VIDEO} {REVERSE } {REVERSED } WITH {COLOR } color-val {COLOUR} {FOREGROUND-COLOR } IS fg-color {FOREGROUND-COLOUR} {BACKGROUND-COLOR } IS bg-color {BACKGROUND-COLOUR} {HIGHLIGHT} {HIGH } {BOLD } {LOWLIGHT } {LOW } {STANDARD } {BACKGROUND-HIGH } {BACKGROUND-LOW } {BACKGROUND-STANDARD} { [USER-GRAY] [USER-WHITE] } { USER-COLORS } BOXED SHADOW TITLE-BAR [TOP ] [CENTERED] TITLE IS title [BOTTOM] [LEFT ] [RIGHT ] WITH SYSTEM MENU WITH NO SCROLL WITH NO WRAP {NO-CLOSE} {AUTO-RESIZE} {RESIZABLE } MIN-SIZE {= } min-size {IS} MAX-SIZE {= } max-size {IS} MIN-LINES {= } min-lines {IS} MAX-LINES {= } max-lines {IS} CONTROL VALUE {IS} control-val {= } LAYOUT-MANAGER {IS} manager {= } VISIBLE {IS} {TRUE } {= } {FALSE } {visible-state} POP-UP MENU {IS} {menu-1} {= } {NULL} {POP-UP AREA IS } handle-name {HANDLE {IS} } {IN} CONTROLS-UNCROPPED EVENT PROCEDURE IS { proc-1 [ {THROUGH} proc-2 ] } {THRU } { NULL } ACTION {IS} action {= }
The optional GRAPHICAL phrase directs the compiler to use a default CELL phrase equivalent to:
CELL SIZE = LABEL FONT
This phrase establishes the window's coordinate space based on the font used by controls that occupy the window. The CELL phrase can still be used and any values set in that phrase take precedence over the default value established with GRAPHICAL option. In other words, if you specify only a CELL HEIGHT or CELL WIDTH, then the other dimension receives the default assignment.
The intent of the GRAPHICAL option is to make it easier to consistently establish an appropriate coordinate space for windows that contain only controls (see the discussion of cell sizing and coordinate space that is included with the CELL phrase rules, below).
For example, the window that is specified with:
DISPLAY FLOATING WINDOW, CELL SIZE = LABEL FONT
can be more simply specified with:
DISPLAY FLOATING GRAPHICAL WINDOWUPON Phrase
The UPON phrase specifies the parent of the new floating window. Parent-window must be a valid floating window handle. If the UPON phrase is omitted, the current window is used as the parent. If you create a new floating window in the scope of an UPON phrase, the new window becomes the current window when the DISPLAY statement terminates.
MODAL and MODELESS PhrasesThe SCREEN LINE and SCREEN COLUMN phrases determine the initial location of the window on the screen. screen-line and screen-col give the coordinates of the upper left corner of the window in screen base units. Screen base units are machine dependent. On character systems, they are character cells. On graphical systems, they are pixels. The upper left corner of the screen is location 1,1. Under Windows, the runtime ensures that the initial window is fully visible, so the specified location may not be used if that would place a portion of the window off the screen (the closest allowed location is used). Windows other than the initial window may be placed arbitrarily. On graphical systems, the location of a floating window is interpreted to mean the location of its exterior. On character systems, the location is the same as it is for subwindows: the location of the window's interior.
LINE, COLUMN, and AT PhrasesIn all cases, the positioning is relative to the parent window as physically displayed on the screen, ignoring any aspect of the window not currently displayed. Thus, if the current window is the main application window, and that window has been scrolled by the user, line 1 refers to the first line of the physical window--not the (undisplayed) first line of the main application window.
The FONT phrase assigns the font that will be used for all textual ACCEPT and DISPLAY statements used in the window. This also sets the default cell size to the size of the 0 (zero) character described by font-1. The cell size determines the height of one row and the width of one column. The font described by font-1 must be a fixed-width font. If it is not, or if the FONT phrase is not specified, then the font used is the same as the one used by the parent window.
CONTROL FONT PhraseThe CONTROL FONT phrase specifies the default font to use for any graphical controls displayed in this window. If you omit the CONTROL FONT phrase, a system default is used (the font DEFAULT-FONT).
CELL PhraseThe CELL phrase defines the height, or width, or height and width of one cell in the window. A cell defines the height of one row and the width of one column. The default cell size is set by the size of the font used in the window.
The cell size is described in terms of cell units. The exact meaning of a cell unit is machine-dependent. Typically, for character-based systems, one cell unit is equal to the height or width (as appropriate) of one screen character. On graphical systems, a cell unit is typically one pixel in size. When developing programs, you should avoid writing code that depends on fixed (hard-coded) values for cell units.
The HEIGHT option of the CELL phrase defines the cell height for the new window. The WIDTH option defines the width. The SIZE phrase defines both the height and width together.
The cell-units option sets the cell's height, or width, or both, to the value of cell-units.
The control-type-name phrase causes the cell height, or width, or both, to be based on a particular font and control type. The system measures the size of font-2 when it is used in a control described by control-type-name, and sets the cell size accordingly. This option is typically used to set the coordinate space of the window to one that is convenient for aligning several controls of a particular type and font. Note that the font handle (font-2) is not required. When it is omitted, the window's CONTROL FONT is used. Also note that if the font handle is omitted, the optional word FONT is required (in order to avoid ambiguity with the FONT phrase).
If the SEPARATE option is specified, then a system-dependent amount is added to the measured font height to provide for some vertical separation between controls. This is typically used to provide some space between boxed entry-fields on adjacent rows. On the other hand, if OVERLAPPED is specified, the height is reduced by the size of the top border of a boxed entry field. This causes boxed fields on adjacent rows to share a common border.
The runtime currently limits control-type-name to be either a LABEL or ENTRY-FIELD. If another control type name is used, the runtime treats it as if it were type "LABEL".
If a window's cell width does not match the width of its font, or if its cell height is less than the height of its font, then the effects of a textual ACCEPT or DISPLAY statement in that window are undefined. If its cell height is larger than its font's height, then the characters are positioned at the top of each cell, and the lower portion of the cell is filled with the text's background color.
In particular, if the relative size of the font you use in your controls changes in relation to the system's fixed font, then you will experience problems, including overlapping controls. This is because the default cell size that defines the coordinate space is based on a fixed-size font in order to maintain compatibility with character-based applications. The size relationship between the variable-pitch font used in controls and the default fixed-font that defines the coordinate space determines the appearance of the screen. If the relationship changes, the appearance of the screen changes. One way that this can happen is if the end user's machine is missing one of the fonts. In this case, Windows will substitute a different font, which may be a different size. To avoid these problems, define your coordinate space based on the same font that your controls use (with the CELL phrase). Then if the font changes the entire screen is rescaled uniformly.
For example, the following statement defines the coordinate space based on the font used with entry fields. This definition allows you to easily position entry fields vertically with LINE 1, LINE 2, etc., and have it look right.
CELL SIZE IS ENTRY-FIELD FONT SEPARATEUSER-GRAY, USER-WHITE, and USER-COLORS Phrases
The USER-GRAY, USER-WHITE, and USER-COLORS phrases provide a convenient way of matching your application's normal colors to those chosen by the user. The USER-GRAY option causes the palette manager to map color number 8 (low-intensity white) to the color that the user has chosen to use with 3-D objects on the host system. Similarly, USER-WHITE maps color number 16 (high-intensity white) to the color the user has chosen to be the normal background color for application windows. If you arrange your application so that it uses color number 8 as the background for regions populated with graphical controls, and color number 16 for plain text regions, your application will look much like other applications on the system.
The USER-COLORS phrase indicates that you want to apply both the USER-GRAY and USER-WHITE options. These phrases are effective only on host graphical systems that have a palette manager. On other systems, these phrases have no effect. Also, note that the palette applies to the entire application. Because of this, you usually specify these options only on the first window you create.
The TITLE-BAR phrase indicates that you want to have a title bar placed along the top edge of the new window. This phrase is automatically implied by the TITLE phrase (exception: this is not true if you also use the CONTROL VALUE phrase). Under some GUIs (including Windows), you must place a title bar in order to move the floating window with the mouse. Without a title bar, the user's ability to move the window depends on the host GUI. Note that you can have a title bar without specifying a title.
SYSTEM MENU PhraseThe SYSTEM MENU phrase causes a system menu (also known as a close box) to appear on the created window. This menu allows the user to close the floating window. It may also have additional properties depending on the host system. Under Windows, this menu contains the Move and Close operations. If you include a system menu, your program must be ready to act on a close window event (cmd_close) at any time. See Configuration Section, and Events Reference, in User Interface Programming for more information. See QUIT_MODE Appendix H for shutdown handling options. Note that the SYSTEM MENU phrase also implies the TITLE-BAR phrase.
NO-CLOSE PhraseThe NO-CLOSE phrase causes the window's Close menu option to be disabled. This option can be applied only when the window is created and its effects cannot be reversed (the associated window's Close option is permanently disabled). The NO-CLOSE option takes precedence over other settings, including the setting of the QUIT_MODE configuration variable.
AUTO-RESIZE and RESIZABLE PhrasesACTION-MAXIMIZE | maximizes the window. It has the same effect as if the user clicked the maximize button. Allowed only for windows that have RESIZABLE or AUTO-RESIZE specified or implied for them. |
ACTION-MINIMIZE | minimizes the window. Allowed only with INDEPENDENT windows that have the AUTO-MINIMIZE property set to true. It is not supported
with other types of floating windows; if set, it is ignored by the runtime.
ACTION-MINIMIZE has the same effect as if the user clicked the minimize button. |
ACTION-RESTORE | If the window is currently maximized or minimized, restores the window to its previous size and position; otherwise, it has no effect. Allowed only for windows that can be maximized or minimized. |
The CONTROL VALUE phrase allows you to specify certain attributes of the new window at run time instead of at compile time. control-val must be a numeric expression. In it, you can specify certain floating window traits by adding together any of the following values:
Boxed | 1 |
Shadow | 2 |
No Scroll | 4 |
No Wrap | 8 |
Reverse | 16 |
Title-Bar | 32 |
System Menu | 64 |
User-Gray | 128 |
User-White | 256 |
For each value specified, the corresponding attribute is given to the new window. When a value is not specified, the presence or absence of that trait depends on the other phrases included in the DISPLAY FLOATING WINDOW statement. Note that you can only give traits to a window with the CONTROL VALUE phrase; you cannot negate traits specified by the DISPLAY FLOATING WINDOW statement. For example, if you want to specify at run time whether or not a window gets a shadow, you should omit the SHADOW phrase from the DISPLAY FLOATING WINDOW statement and use a CONTROL VALUE phrase to add shadowing when you want it.
LAYOUT-MANAGER PhraseThe LAYOUT-MANAGER phrase attaches a layout manager to the window.
VISIBLE PhraseThe VISIBLE option determines whether the window created is visible or invisible. If the FALSE option is used, or visible-state is the value zero, then the window is invisible. Otherwise, the window is visible. If the VISIBLE phrase is omitted, then the window is visible.
POP-UP MENU PhraseThe POP-UP MENU phrase associates a pop-up menu with the window. If menu-1 is specified, then the menu associated with menu-1 becomes the pop-up menu. If NULL is specified, the window is not given a pop-up menu. Pop-up menus are activated by a machine-dependent technique. Under Windows, the technique is to right-click on the window's background.
CONTROLS-UNCROPPED PhraseNormally, when you create a control in a window, the control is cropped to fit the current subwindow's dimensions. In addition, if the control's home position is outside of the current subwindow, the control is not created. Adding the phrase CONTROLS-UNCROPPED overrides these rules. When this phrase is used, the control is created with the specified location and dimensions, regardless of whether the control will be physically in the window.
This can be useful when you are dealing with RESIZABLE windows. Sometimes a resizable window is too small to show all of the controls that your program creates. Normally, these controls either would not be created or would be cropped. This could produce odd results when the window is later resized larger by the user. Although the resized window is now large enough to show everything, the controls still show their cropped appearance, because their (cropped) creation size is recorded in the controls as their actual size. Specifying CONTROLS-UNCROPPED avoids the cropping behavior.
This style is useful also when you want to place a combo-box near the bottom of a window. Because the size of the drop-down portion of the combo-box is determined by the control's overall height, cropping the control limits the drop-down box to the window's boundaries. If you want the box to drop down beyond the edge of the window, you need to use the CONTROLS-UNCROPPED window style to allow this.
EVENT PROCEDURE Phrase