Path: utzoo!attcan!uunet!cs.utexas.edu!usc!apple!stanbach From: stanbach@Apple.COM (Francis Stanbach) Newsgroups: comp.sys.mac.programmer Subject: Re: Problem at closeDev Keywords: cdev dialog Message-ID: <10369@goofy.Apple.COM> Date: 22 Sep 90 17:21:54 GMT References: <1990Sep18.234445.28711@ux1.cso.uiuc.edu> Distribution: comp Organization: Apple Lines: 32 In article <1990Sep18.234445.28711@ux1.cso.uiuc.edu> resnick@cogsci.uiuc.edu (Pete Resnick) writes: >"Pete, you dope. This is simple. You forgot the semi-colon." Whatever... > >hit and when the cdev gets closed. On the hitDev, everything works >just ducky. I call the routine, passing it CPDialog, a handle to my >data (I do it the old fashioned way), and numItems. I check each to >make sure they have valid values entering the routine. They are all >constant on entering. Then I do a GetDItem for the editText box. >Boom. The value returned in the item Handle when I am on the hitDev >is some longword. On the closeDev, I get a 0. Now, I don't know for >sure that all the values in CPDialog and my data handle are correct >(doing that in Macsbug would've been ugly), but I am sure numItems >has not changed and the actual value of CPDialog and my data handle >are perfectly constant. Do the dialog items disappear before the >closeDev (that would be very bad, and unlikely since I have seen other >cdevs check data on the close), or am I doing something stupid? > >If you would like to see actual code, I would be willing to trim down >to a small non-working piece and send it to you. Any help would be >*greatly* appreciated. This got me and almost everyone who has written a cdev. The Control Panel destroys the dialog before it sends the closedev message. You need to maintain your own copy of the values of the controls in your cdev. Use the closedev message to cleanup globals or whatever, but the dialog isn't there. Francis -- wmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwm Francis Stanbach Finder Engineer Apple Computer, Inc. wmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwmwm