Please enable JavaScript to view this site.

ESL Documentation

Navigation: » No topics above this level «

Q22 How does modality work in ESL?

Scroll Prev Top Next More

There are two types of modality available in the Windows operating systems; application modal, and system modal. Application modal dialog boxes block the entire application from processing until the dialog box is responded to. System Modal dialog boxes prevent the entire operating system from processing until the message box is responded to. Application modality is the only form of modality that is available to ESL applications. This can be achieved in one of the following three ways:

1.ESL Modal dialog boxes

When a modal dialog is made visible in an ESL application, secondary windows that are children of the primary region, the primary region itself or other modal dialog boxes that may be visible while the modal DB is visible, cannot be selected. However, secondary windows that are children of the desktop can be selected.

In Windows, the only way Windows itself can tell who owns a particular window is by the chain of window parent id's.  Therefore if a window is a child of the desktop, Windows has no way to identify it as part of the application when it is enforcing modality. The Windows SDK manual says: "A modal dialog box disables its parent window, and it creates its own message loop, temporarily taking control of the application queue from the main loop of the program." Since Windows maintains a message queue for each window, it holds up message processing only for those windows that are in the same ancestry tree. ESL sets the owner of a modal dialog box to be the ESL window that has the focus when the modal dialog box is made visible (this is not always the primary window, but often is).

2.Modality with the ReplyToMessage functions

When a ReplyToMessage function is called a message box is displayed. The user cannot select any other visible ESL objects until the user responds to the message box. Note that while the message box is displayed the ESL application will loose any stimulus messages that are sent. However, with the use of the make stimulus disposition action statement all stimulus libraries can be set to queue any stimulus message received while in the ReplyToMessage function. Once the ESL application returns from the ReplyToMessage function, the stimulus libraries can be released and the stimulus messages can be processed.

3.User Written Modality

With the use of classes an ESL developer can make any dialog appear to be modal to all other visible ESL objects. To achieve this simply create a class which will contain the names of all visible objects. When you wish to display your modal dialog box you can simply disable the class. Once the user makes the appropriate response to the pseudo modal dialog box, the class will then become enabled. Using this technique will allow a developer to achieve true application modality without being concerned by stimulus messages.