Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!claris!wombat From: wombat@claris.claris (Scott Lindsey) Newsgroups: comp.sys.apple Subject: Re: 2 more IIGS programming questions Message-ID: Date: 29 Jun 89 05:22:08 GMT References: <9760@boulder.Colorado.EDU> Sender: wombat@claris.com Organization: /usr/u/wombat/.organization Lines: 39 In-reply-to: hartkopf@tramp.Colorado.EDU's message of 29 Jun 89 02:06:16 GMT From: hartkopf@tramp.Colorado.EDU (HARTKOPF JEFFREY M) Newsgroups: comp.sys.apple Date: 29 Jun 89 02:06:16 GMT Reply-To: hartkopf@tramp.Colorado.EDU (HARTKOPF JEFFREY M) Organization: University of Colorado, Boulder 1) I've been having a problem getting a new desk accessory which needs to use Standard File (SF) to work. The problem occurs when, since SF is not assumed to be loaded, I need to load and start it up. There's a few problems with your code. First, when you call SFStatus, you assume that you will get a tool error if StdFile hasn't been loaded & started. The first half is true. You get error $0002 if the tool hasn't been loaded. If, for some reason (say the finder runs a program which loads, uses, then shuts down StdFile & returns to the finder) it's loaded but not started you'll get no error but you still won't have an active StdFile. You need to look at the value returned by SFStatus in addition to checking the tool error. Now, the answer to your real question is that the memory you allocated for StdFile's direct page is still allocated. You allocate it, you dispose of it. Simple rule. One more thing regarding NDA's & tools. I tend to put tool loading & startup in the Open vector of an NDA (unless the NDA does something with heartbeat tasks that requires those tools). Reasoning: if it isn't needed by the user, why bother to load it & take up memory. However, I don't shut down those tools on a close, just on a NDA shutdown call. Text & windows: you might consider LETextBox or LETextBox2 if you have less than 32K of text. You might also calculate where you're drawing text & compare it to the update region (or even just the bounding rect of the update region) and quit drawing when you're no longer visible. -- Scott Lindsey |"Cold and misty morning. I heard a warning borne in the air Claris Corp. | About an age of power when no one had an hour to spare" ames!claris!wombat| DISCLAIMER: These are not the opinions of Claris, Apple, wombat@claris.com | StyleWare, the author, or anyone else living or dead.