Dialog

Section: ET++ class description (n)
Updated: automatically Fri Mar 15 14:08:59 1991
Index Return to Main Contents
 

NAME

Dialog - undoable dialog boxes  

DESCRIPTION

The abstract class Dialog implements modeless and modefull dialog boxes. A Dialog installs itself in a window and automatically closes that window whenever an ActionButton is selected. Dialog additionally defines a framework for undoable dialog boxes. It provides several abstract methods to save the current state of the dialog items when the dialog is opened, to restore the original state when the dialog is cancelled and to store the modified data when the dialog is accepted.
The layout of a dialog box is the responsibility of subclasses which have to override the abstract method DialogView::DoCreateDialog in order to create the dialog tree.


Modefull vs. Modeless


Opening a modefull dialog preempts any input in another window of the application until the dialog is closed again. Modefull dialog windows are used, for example, by the class Alert and the class FileDialog. Modeless dialogs, however, do not block other windows. An example for that is the "Find/Change" dialog (see class ChangeDialog).
Whether a dialog is modefull or modeless is specified in the windowFlags argument of the constructor of Dialog. If the flag eBWinBlock is set, then the dialog is modefull, otherwise it is modeless (see also enum BWinFlags).


Opening a Dialog


Dialogs are opened either with the method Show or the method ShowOnWindow. The first one opens the window at the position where the last mouse event occurred whereas the latter positions the window at the center of a VObject. Before the dialog is opened the actual position is additionally modified by the method GetInitialPos. The default implementation returns the center of the default ActionButton which means that after opening the dialog that button is always exactly located under the mouse cursor.
If the dialog is modefull, then Show and ShowOnWindow block until the dialog is accepted or cancelled and then return the id of the selected ActionButton.
In case of a modeless dialog Show and ShowOnWindow immediately return after opening the dialog window without waiting for events. This means that the returned id cannot be used. The method Control has to be overridden and events from dialog items must be processed there.


Dialog Setup


The purpose of the method DoSetDefaults is to initialize the dialog items with some reasonable default values. The method DoSetup has to enable/disable the dialog items and initialize their values according to the data shown in the dialog. DoSetup is called whenever the dialog is opened whereas DoSetDefaults is called only when the dialog is opened the first time. Both methods are also invoked if a dialog item with the id const cIdDefault is selected.


Validation, Acceptation, Cancellation


If an ActionButton, whose id is different from const cIdCancel, is selected, then the dialog is validated. Validation means that all dialog items check whether the data entered by the user can be accepted; e.g. the class NumItem tests whether the entered number is in a certain range. If validation fails an error is reported and the dialog window stays open.
A dialog is accepted when the Ok button (an ActionButton with the id const cIdOk) is selected and validation is successful. The data entered by the user is then stored by the method DoStore and the dialog window is closed.
Cancellation is triggered by the Cancel button (an ActionButton with the id const cIdCancel). The data entered by the user is discarded. The original data, which has been saved by the method DoSave before opening the dialog window, is restored through the method DoRestore and the dialog window is closed.
Validation, acceptation and cancellation is performed by the method Control.


classes are always derived from Dialog.
class Dialog is never reused directly.
class Dialog is abstract.
class Dialog contains 15 methods.

owner of class:
nobody.
baseclasses:
DialogView
subclasses:
Alert, ApplDialog, FileDialog, FindDialog, GotoDialog, PrintDialog, Printer
flags:
ViewFlags

 

INSTANCE VARIABLES

actionId (protected int)
contains the id of the ActionButton that caused the dialog window to be closed. The actionId is returned by the method Show and the method ShowOnWindow and indicates whether the dialog has been accepted (const cIdOk, const cIdYes) or cancelled (const cIdCancel).

dw (protected BlankWin *)
contains the dialog window created in the constructor. It is either an instance of the class BlankWin or the class Window depending on whether a window title is specified. The Dialog installs itself in this window. See method Dialog.

 

INSTANCE METHOD LIST

client interface
Close
SetTitle
Show
ShowOnWindow

implementation
Dialog
ShowAt
~Dialog

miscellaneous
InspectorId

overrider interface
Control
DoRestore
DoSave
DoSetDefaults
DoSetup
DoStore
GetInitialPos

 

CATEGORIES

Dialogs

 

FILES

declaration:
Dialog.h

 

KNOWN PROBLEMS

See method ShowAt.  

HISTORY

joe@csesbg.at  Fri Apr 5 16:07 1991

joe@csesbg.at  Thu Jun 27 18:25 1991   instvars, methods

joe@csesbg.at  Wed Jul 03 13:04 1991   main description

chris@csesbg.at        Thu Jul 11 18:22 1991   reviewed

man2html: unable to open or read file ../mann/Dialog::Close.n
man2html: unable to open or read file ../mann/Dialog::Control.n
man2html: unable to open or read file ../mann/Dialog::Dialog.n
man2html: unable to open or read file ../mann/Dialog::DoRestore.n
man2html: unable to open or read file ../mann/Dialog::DoSave.n
man2html: unable to open or read file ../mann/Dialog::DoSetDefaults.n
man2html: unable to open or read file ../mann/Dialog::DoSetup.n
man2html: unable to open or read file ../mann/Dialog::DoStore.n
man2html: unable to open or read file ../mann/Dialog::GetInitialPos.n
man2html: unable to open or read file ../mann/Dialog::InspectorId.n
man2html: unable to open or read file ../mann/Dialog::SetTitle.n
man2html: unable to open or read file ../mann/Dialog::Show.n
man2html: unable to open or read file ../mann/Dialog::ShowAt.n
man2html: unable to open or read file ../mann/Dialog::ShowOnWindow.n
man2html: unable to open or read file ../mann/Dialog::~Dialog.n


 

Index

NAME
DESCRIPTION
INSTANCE VARIABLES
INSTANCE METHOD LIST
CATEGORIES
FILES
KNOWN PROBLEMS
HISTORY

This document was created by man2html, using the manual pages.
Time: 00:40:29 GMT, March 30, 2022