Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!purdue!decwrl!ucbvax!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: cdev question: Why does GetDItem return bad value on closeDev? Message-ID: <8096@hoptoad.uucp> Date: 22 Jul 89 16:49:47 GMT References: <783@kinetics.UUCP> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 36 In article <783@kinetics.UUCP> mahboud@kinetics.com (Mahboud Zabetian) writes: >Does anyone know what state the Control Panel is in at the time of a closeDev >call? I do a GetDItem and SetIText when I get a closeDev call, but it never >works, and sometimes it even crashes. Well, there's no documentation of this point and it's been over a year since I wrote my last CDEV, but as I recall, closeDev is sent only after your items have been removed from the dialog item list. If you try to access them at that point, you will likely crash. >In macsbug I notice that my DITL list is still pointed to by the Control Panel >window and that my cdev file is still open. So why am I not getting a valid >Handle back from GetDItem? Your file's still open, sure. How else could it acess your 'cdev' resource? However, with respect to the dialog item list, there is *a* dialog item list, but if you check more carefully I think you will find that it contains only the generic CDEV dialog items, not yours. >On a related note- what happens when you get an updateDev call? I do some >drawing in the cdev window, which will get erased as soon as I get another >message(other than a nulDev), but this drawing almost never is seen. I know >that the code for it gets executed, but the drawing seems to be wiped out with >something. You should only draw into user items in your dialog, and before doing so you should clip to either the user item or to the whole window to make sure you aren't clipped out. To do the latter, "ClipRect(&CPDialog->portRect);" before drawing. -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com "What's the ugliest part of your body? Some say your nose, some say your toes, But I think it's your mind." -- Frank Zappa