Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!uwvax!tank!shamash!nic.MR.NET!ns!jmh From: jmh@ns.network.com (1606) Newsgroups: comp.sys.mac.programmer Subject: Mangled Dialog Summary: Current non-working dialog Keywords: Dialog Message-ID: <1424@ns.network.com> Date: 1 Jun 89 14:37:34 GMT Sender: jmh@ns.network.com (Joel Halpern 424-1606) Reply-To: jmh@ns.UUCP (Joel Halpern 424-1606) Organization: Network Systems Corporation Lines: 53 The last time I posted this, I wrote the code from memory. Most of the comments I received were on errors I introduced in trying to remember the various calls. The only actual change between the last crashing dialog handler and this crashing dialog handler is that the string variable is now a static of size 256. This does not help: void handle_my_dialog(theDialog) DialogPtr theDialog; /* The caller had called GetNewDialog to get this pointer */ { static char strbuf[256]; int itt; Handle h; Rect box; int theItem; GrafPtr oldport; GetPort(&oldport); SetPort(theDialog); GetDItem(theDialog, 2, &itt, &h, &box); sprintf(strbuf+1, "%-3d", val); strbuf[0] = strlen(strbuf+1); SetIText(h, strbuf); do { ModalDialog(NIL, &theItem); if (theItem == 2 /* yes, this is the right number */) { GetDItem(theDialog, 2, &itt, &h, &box); /* it has been suggested that the above line is redundant but harmless */ GetIText(h, strbuf); /* process the text in strbuf */ } } while (theItem != 1 && theItem != 3 && theItem != 4); if (theItem == 4) { /* reset counters to ignore changes */ } else { /* process changed value */ } SetPort(oldport); /* the caller will call CloseDialog *. } As I said before, this crash if I invoke it twice. The second time, the crash occurs when I try to select the edittext item. The debugger frequently prevents the crash. If it crashes while I am singlestepping through this routine, the crash occurs when I call ModalDialog. Thanks, Joel M. Halpern jmh@nsco.network.com Network Systems Corporation