Specifications
Developer Technical Support May 1992
Apple IIGS
#71: DA Tips and Techniques 9 of 6
NDAs Must Be Careful Handling Modal Windows
If your NDA uses its resource fork and calls TaskMaster with a restricted wmTaskMask to
produce a modal window, you must be careful not to allow TaskMaster to update the contents
of any application windows that happen to need updating.
The problem is that an application window’s wContDraw routine can reasonably assume that
the current Resource Manager search path is the application’s, but TaskMaster does not take
any special steps to set it. When the content-draw routine draws controls which were created
from resources which are not presently in the resource search path, the system may crash.
If your NDA does not start up the Resource Manager, the Desk Manager is unable to
SetCurResourceApp to your NDA, so the application’s search path is still in effect—no
problem. But if your NDA does start the Resource Manager, you have to be careful not to cause
application routines to be called.
Avoid Hard-Coding Your Pathname
If your NDA needs to know its own pathname or the pathname of the directory it’s in, call
LGetPathname or LGetPathname2 using your User ID. This is a better method than hard-
coding “*:System:Desk.Accs:MyDAName” because the user may change your DA’s file name
or use a utility to install it from some non-standard directory.
Avoid Extra GetNewID calls
Normally there is no reason for a Desk Accessory to call GetNewID. When you can, just call
MMStartUp to find your own User ID, and use that. You can freely use all the auxiliary IDs
derived from your main ID (MMStartUp+$0100, MMStartUp+$0200, ...,
MMStartUp+$0F00).
By not calling GetNewID, you conserve the limited supply of IDs (255 of in the $50xx range
for Desk Accessories), and you make life easier for people trying to debug their systems, since
all your allocated memory can be readily identified.
Open is Not Called if NDA is Already Open
Your NDA’s Open routine does not get called if the user chooses the NDA from the Apple menu
while the NDA is already open. In this case, the Desk Manager simply calls SelectWindow
on your existing window.
There is no need to include code in your Open routine to check if your window is already open,
and to call SelectWindow if it is.
Further Reference
• Apple IIGS Toolbox Reference, Volumes 1-3
• GS/OS Reference










