Path: utzoo!utgpu!water!watmath!clyde!rutgers!labrea!decwrl!pyramid!voder!apple!tecot From: tecot@apple.UUCP (Ed Tecot) Newsgroups: comp.sys.mac Subject: Re: Control Panel Bug? Message-ID: <7114@apple.UUCP> Date: 25 Dec 87 06:13:51 GMT References: <9931@ut-sally.UUCP> <3646@husc6.harvard.edu> <9948@ut-sally.UUCP> Reply-To: tecot@apple.UUCP (Ed Tecot) Organization: Apple Computer Inc., Cupertino, USA Lines: 35 In article <9948@ut-sally.UUCP> brian@ut-sally.UUCP (Brian H. Powell) writes: >> In article <9931@ut-sally.UUCP> brian@ut-sally.UUCP (Brian H. Powell) writes: >>> >>> In a program I'm working on, I load all the cursors that I am going to >>>use at the beginning of the program, move them to high memory, lock them down, >>>dereference the handles and use pointers to them for the duration of the >>>program. Fine. > >In article <3646@husc6.harvard.edu>, singer@endor.harvard.edu (Rich Siegel) writes: >< It's not good practice to lock a handle, then keep its master pointer >< around, because exactly that sort of thing can happen. The best way to >< get the same effect is to preload the CURS resources and keep the CursHandles >< as global variables. > > That's sounds like a good idea, but I've got a question about it. I >presume I should then have global handles to the cursors. I shouldn't have >them locked. So, my call would be > SetCursor(*watch_cursor_hdl); /* in C */ > > But what if the cursor relocates while the watch is being displayed? I >guess the question is, "Does SetCursor make a copy of the cursor and use that, >or does it use the actual cursor that it's given?" If it's the latter, I'll >have to copy the cursor into a non-relocatable block of memory and use it >there. What a waste. Yes, SetCursor does copy the cursor. I'd also recommend not using global variables, instead, simply use the following: theCursor = GetCursor(cursorID); if (theCursor != nil) SetCursor(*theCursor); or in Pascal: theCursor := GetCursor(cursorID); IF theCursor <> NIL THEN SetCursor(theCursor^^); _emt