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

Chapter 2. DCODs

2.2 Asynchronous DCODs

To create a non-modal dialog, you must write an asynchronous DCOD. To notify the DCOD manager that it is running asynchronously, a DCOD must set -1 as the result in the returnValue field of the DCODParams record.

The DCOD manager assumes that asynchronous dialogs are controlling non-modal dialogs. For this reason, an asynchronous DCOD must have a dialog that is the frontmost window when it returns from handling the dialog message. The DCOD lets the DCOD manager know when it is done by calling RemoveWindowFromAsyncList(), passing in its window.

If you want to write an asynchronous dialog that does not control a non-modal dialog, you can hack it together this way: create a dummy window off-screen (but still as the frontmost window), and pass back -2 instead of -1 in returnValue. The DCOD manager will hide the window so that it doesn't get in the user's way, but you still use this window for RemoveWindowFromAsyncList().

A DCOD implementing a non-modal dialog is responsible for interfacing with PsyScope's non-modal dialog architecture. This system involves registering the window with a table of callback functions. The functions are called to the let the DCOD handle user events, background tasks, etc. See "Chapter 12. Windows in PsyScope" for more information.

If some menu item has opened an asynchronous dialog item, reselecting the item should open the same dialog. The DCOD manager makes no attempt to handle this problem, so the DCOD is responsible for noticing when it is asked to do something that it is already doing. Utilities have been provided to help solve this problem: RegisterRefWindow(), GetRefWindow(), and RefWindowClosed(). See "Chapter 12. Windows in PsyScope".

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

Generated with CERN WebMaker