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

mikef@bbs.acs.unc.edu (Michael Freedburg) (02/26/91)

Killer question, folks!!
I have a neat little palette which the user can show by clicking
on a button called "Show Palette". Once the palette appears, I
can easily have the button hide itself, but now the matter at
hand.....
HOW do I tell when the user closes the palette? Wen I use the
Message Watcher (which is really supercool, BTW) no message
appears when I close the palette. Is there a message sent, or is
there some way to determine when the palette is closed??
I **do not** want to do some stupid "on idle" handler to check
for the palette, since using on idle and not passing it
correctly is one reason I am rewriting this person's stack in
the first place!!

##$$Great Hint: Ever been stymied by the need to have the user
click on a button **and** keep text selected?? Use a palette,
since when a button is clicked there, the selection on the card
is not disturbed!!
Send Help Soon
Love and Peace
mikef@samba.acs.unc.edu
or
mikef@next1.mscre.unc.edu

kamins@kumr.lns.com (Scot Kamins) (02/27/91)

>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!

 

-- 
Scot Kamins         Co-author, "HyperTalk 2.0: The Book"
(415) 282-8872                        (with Dan Winkler)      
671 28th Street            San Francisco           94131
kamins@kumr.lns.com                      kamins@wet.UUCP

gft_robert@gsbacd.uchicago.edu (opcode ranger) (02/28/91)

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?  In any case, in a stack
I'm writing I end up opening my palette everytime I enter a certain background,
and closing it (if it hasn't been closed, which I determine with the "there is"
operator) everytime I leave the background.

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.

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?

Any info much appreciated (since I don't want my client's stack to start
crashing! :->).

Robert


-- 
============================================================================
= gft_robert@gsbacd.uchicago.edu * generic disclaimer: * "It's more fun to =
=            		         * all my opinions are *  compute"         =
=                                * mine                *  -Kraftwerk       =
============================================================================