/*__generic dialog function! pass it wind ID & ID of up to 3 controls, with__*/ /*__nil for control IDs you don't use. It will pass back the ID of the_______*/ /*__control that was hit_____________________________________________________*/ int doDialog (long windID,int cont1ID,int cont2ID,int cont3ID) { GrafPortPtr oldPort,theWindow; WmTaskRec myTask; int taskCode,done,resType; resType = 0x800E; oldPort = GetPort(); theWindow = NewWindow2(nil, /* title pointer */ nil, /* refcon for the window */ nil, /* */ nil, /* defProcPtr */ refIsResource, /* paramTableDesc */ windID, /* windID passed to us */ resType); /* standard type window */ SetPort(theWindow); ShowWindow(theWindow); DrawControls(theWindow); myTask.wmTaskMask = 0x001F2006; done = false; do { taskCode = TaskMaster(everyEvent,&myTask); switch (taskCode) { case wInControl:if ((myTask.wmTaskData4 == cont1ID) || (myTask.wmTaskData4 == cont2ID) || (myTask.wmTaskData4 == cont3ID)) done = true; break; case wInMenuBar: case wInDesk :SysBeep(); } } while (!done); CloseDialog(theWindow); SetPort(oldPort); return((int) myTask.wmTaskData4); } /* end: doDialog */