Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!udel!haven!umbc3.umbc.edu!umbc5.umbc.edu!cs483106 From: cs483106@umbc5.umbc.edu (cs483106) Newsgroups: comp.sys.mac.programmer Subject: Re: Check DialogPtr returned by GetNewDialog? Message-ID: <1991Apr3.003322.20295@umbc3.umbc.edu> Date: 3 Apr 91 00:33:22 GMT References: <4143@uakari.primate.wisc.edu> <1991Apr1.224254.5399@neon.Stanford.EDU> <1991Apr2.142214.980@ux1.cso.uiuc.edu> Sender: newspost@umbc3.umbc.edu (News posting account) Organization: University of Maryland Baltimore County Lines: 36 In article <1991Apr2.142214.980@ux1.cso.uiuc.edu> dorner@pequod.cso.uiuc.edu (Steve Dorner) writes: |>-> Do any of you check to see if the DialogPtr that GetNewDialog returns is |>-> valid in any way? |>>You want to read Technical Note 4 and then hold your breath in awe |>>at the advice it gives: |>> Assume there is no error |>So what do you want do if there IS an error... put up an ALERT dialog? |There are any number of reasonable things you could do, if you knew that |GetNewDialog had failed: | |1. Skip the alert, and hope for the best. |2. Pitch some clean windows, and then try an alert. |3. Put up a 'vital resource not found' alert (which might work). |4. Quietly ExitToShell. | |Any of these alternatives smell better than trying to put up an a nonexistent |dialog. | |I agree with Apple in principle; there's a point at which things are SO BAD |that I don't care what happens anymore. I'm not sure I would have pegged |GetNewDialog as such a place, though. | |Steve Dorner, U of Illinois Computing Services Office |Internet: s-dorner@uiuc.edu UUCP: uunet!uiucuxc!uiuc.edu!s-dorner The most interesting part about this discussion(at least in my opinion) is that on older macs(pretty much everything before the IIsi and LC), you could often get away with doing things such as a HideDialog on a bogus dialog pointer(such as one you got from a GetNewDialog on a non-existant resource). In the older machines, HideDialog would simply ignore it. On the IIsi, HideDialog bombs in this situation. VERY interesting. "Pope" Q.E.D Michael Kohne mikek@isis.ngs.noaa.gov