[comp.sys.mac.hypercard] what message is sent when a palette is closed

fvernon@cudnvr.denver.colorado.edu (Frank Vernon) (03/01/91)

In article <1991Feb27.122238.1@gsbacd.uchicago.edu>
From:gft_robert@gsbacd.uchicago.edu

>In article <1991Feb27.040911.2064@kumr.lns.com>, kamins@kumr.lns.com (Scot Kamins) writes:
>>>HOW do I tell when the user closes the palette?
>> 
>> on closePalette
>>   put "Palette is closed!"
>> end closePalette
>> 
>> Strangely enough, HyperCard sends closePalette to the current card when you
>> (yes) close a palette!   :-}   I found this out this very afternoon!  
>> Seriously!

>Ah, well.  That's not noted in the Script Guide is it?...

No, this is not well documented! Nor are these:

	on closePalette thePalette
	  put "Palette:" && thePalette && "was closed!"
	end closePalette
	
	on openPalette thePalette
	  put "Palette:" && thePalette && "was opened!"
	end openPalette


>My question is this: is there any memory penalty for repeatedly opening an
>closing a palette?  I checked on this by writing a script which did this, and
>put the memory difference before opening the palette and after closing it.  On
>the first time there was less memory in the heap after closing the palette than
>there was before opening it; each sucessive iteration caused no memory loss.

There seems to be no memory penalties involved at all. As a matter of fact, a 
quick browse through the application heap with MacsBug indicates that closing
a palette actually purges the heap and cleans things up a little bit.

>So can one cause a crash if one opens and closes palettes too often?  I doubt
>it, particularly since an XMCD should clean up after itself.  Perhaps the
>initial memory loss is caused by some resources (e.g. the XCMD itself) being
>loaded in the heap?

It does not look there is any problem with this at all. I use palettes quite
a bit and I have not had any problems.


Frank Vernon
Nine to Five Software
Internet: FVERNON@cudnvr.denver.colorado.edu
BitNet:   FVERNON@CUDENVER
America Online: NineToFive