[Next] [Previous] [Up] [Top] [Contents] [Index]

2.1 DCOD Calling Structure

2.1.2 DCOD Style

In order to keep the PsyScope environment consistent, there are a few stylistic guidelines for writing DCODs. Modal Dialogs

DCODs that modify the script using a modal dialog should write script changes immediately when the user does anything. Also, the PsyScope utility ECSModalDialog() should be used instead of the Macintosh Toolbox function ModalDialog().

Following these two guidelines allows other windows to immediately reflect script changes in the background. If the user later decides to reject the changes (i.e., hits Cancel), the DCOD simply sets the returnValue field of the DCODParams structure to 0; the DCOD manager will reverse all of the script changes automatically.

Modal dialogs should also be made movable (by using window type 5). ECSModalDialog() takes care of dragging the window (in System 7.0 and later systems). Non-modal dialogs

Non-modal dialogs are generally better for the user than modal dialogs. Unfortunately, this makes the dialog significantly more complex. See "2.2 Asynchronous DCODs".

Many standard dialogs have modal and non-modal modes. The DCOD caller sets the mode using an "Async" message or attribute. This is useful because the dialog caller can decide which is more important: OK and Cancel buttons, or flexibility. Dialog Position

The position of a non-modal or moveable dialog may be saved by using CloseANamedDialog() instead of DisposeDialog(). When the dialog is later opened with OpenANamedDialog(), it will be automatically opened at its previous position. Position information is stored in the preferences file. - Modal Dialogs - Non-modal dialogs - Dialog Position

PSYX Programmer's Manual - 24 AUG 95
[Next] [Previous] [Up] [Top] [Contents] [Index]

Generated with CERN WebMaker