Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!ncar!ames!uhccux!munnari.oz.au!murtoa.cs.mu.oz.au!jkjl From: jkjl@cs.mu.oz.au (John Keong-Jin Lim) Newsgroups: comp.sys.mac.programmer Subject: Re: cdev question: Why does GetDItem return bad value on closeDev? Message-ID: <2809@murtoa.cs.mu.oz.au> Date: 24 Jul 89 01:24:57 GMT References: <783@kinetics.UUCP> Reply-To: jkjl@murtoa.UUCP (John Keong-Jin Lim) Organization: Comp Sci, Melbourne Uni, Australia Lines: 32 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. > You need to do that before the cdev is closed ( i presume you mean GetIText - SetIText seems pretty useless when closing a cdev !). What you need to do is check for keyDown events and save the characters then. Alternately poll for keyDown events, then on the next null event do a GetIText; that way you dont need to worry about backspace. >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? > If i recall, the TEHandle for your text has been disposed off already. >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. > Are you using BeginUpdate EndUpdate ? Have you set the nrct resource properly ? Have fun (i did when i wrote my first cdev !) john