SAT/DL Using Multiple (Child) Windows
S@
Home SATGUI SATSHELL SATFORM SATFILTER SATREPORT SATMYSQL License Download Examples Contact


Overview

In addition to the main application screen (The parent window), it is possible to create one or more child windows.

The child windows, for the most part, behave as for the parent window. There are, however, some small differences.


Creating Child Windows

A new child window is created using the newWindow command.

Example

newWindow {win1 {"Add Customer"} 80x24}

...Creates a child window called win1 with a title of "Add Customer" and is 80 columns wide and 24 rows deep.

Child windows may be modal. In this case all of the application windows, apart from the modal window, are disabled. Only the modal window is active. This is useful when creating dialog boxes which must have a user response before any other part of the application may be used.

Child windows may have an associated action. The action is invoked when the window is closed using the title bar close button (For example: The "X" button at the top right of a window under Microsoft Windows) -or- The window control menu "Close" or "Quit" options. This can be useful to run a "tidy up" routine -or- in the case of modal windows, to provide a default value.

By default, the window manager will decide where to place a child window on the screen. However; it is possible to specify a specific location.

Example

newWindow {win1 {"Add Customer"} 80x24 +200+100}

...Creates a child window called win1 with a title of "Add Customer", is 80 columns wide and 24 rows deep and is placed, with its top-left corner, 200 pixels to the right and 100 pixels down from the top-left of the screen.

There are two internal variables (:fposition and :tposition) which return the current position of a window.


Using SAT/DL Commands With Child Windows

To specify that a display item is to be added to a child window a dot (".") notation is used.

Example

addEntry {win1.First_Name 2,10 8,20}

...Creates an entry ("first_name") in child window win1. The value of this item, when specifying an action, is win1.first_name.

Most of the "add" commands use this format.

Notes:


Using The Default Window Facility

Where it is required that a series of commands are to add items to a child window, the setWindow command can be used to set the default window in which items will be created.

Example

addEntry {Entry1 1,1 6,20}
setWindow win1
addEntry {Entry2 1,1 6,20}
addEntry {Entry3 1,3 6,20}
...The entry item Entry1 will be created in the main window. Entry items Entry2 and Entry3 will be created in child window win1.

This has the same effect as...

addEntry {Entry1 1,1 6,20}
addEntry {win1.Entry2 1,1 6,20}
addEntry {win1.Entry3 1,3 6,20}
The default window also effects action items...
setWindow win1
addEntry {Entry1 1,1 6,20}
addButton {Test1 1,3 8 {doit entry1}}
The entry Entry1 and the button Test1 are both added to the child window win1. The button action "doit entry1" also refers to the entry1 item in window win1.

When a default window is set, explicitly specifying a window for an item using the dot notation overrides the default. When it is necessary to refer to an item in the parent window for an action when a default window has been set, the name of the item should be prefixed with a dot (".").

Example

addEntry {Entry1 1,1 6,20}
setWindow win1
addButton {Test1 1,1 8 {doit .entry1}}

To set the default window back to the parent window...

setWindow {}


Removing Items And Clearing Child Windows

Individual items are permanently reomved from a child window using the remove command with dot notation.

Example

remove win1.entry1

Child windows can be completely cleared using the clear command.

Example

clear win1


Closing Child Windows

Child windows can be closed using the closeWindow command.

Exmaple

closeWindow win1

It is possible that the user may decide to close a window by using one the title bar close button; (For example: The "X" button at the top right of a window under Microsoft Windows) -or- The window control menu "Close" or "Quit" options. This condition is detected and the display is automatically cleared before closing. However, it may be neccessary (say in the case of a modal window where the user must respond before the application continues) to supply a default response -or- maybe to perform some kind of tidy-up action. To deal with this it is possible to associate an action with a window when it is created using newWindow.

Example

newWindow {win1 {"Add Customer Confirmation"} 40x8 modal setdefault}

...Creates a modal window with an associated action setdefault. If the window is closed using one of the window manager control options the setdefault action is invoked. If the window is closed using closeWindow the action is not invoked.

The action can also specify parameters.

Example

newWindow {win1 {"Add Customer Confirmation"} 40x8 modal {setdefault 'win1' 'no'}

...Here two literal parameters 'win1' and 'no' will be passed to the setdefault action.


Copyright © 2003 Adrian Davis.