Popup Stacks: How to Handle Them
Mac OS 9 Mac OS X Windows Linux

After extensive trial and error, I believe I can now answer the question I posed some days ago (see below): under what circumstances do popped up stacks scroll vertically? (This question is of interest if you want to do anything fancy in the popped up stack, because it does not appear that we have any way of detecting in a script the "scroll" status of that stack.)

The short answer seems to be: to prevent their scrolling (at least in Mac OS9), the height of the stack must be set to greater than or equal to 260 pixels, and less than or equal to the screen height minus 36.

Moreover (this is the part that was somewhat vexing to figure out), this height must be set BEFORE the popup command is given. That is, setting the stack's height in a preOpenStack handler of the stack itself will not work properly, because

(1) Metacard's decision about whether the popped up stack is or is not of a height that needs to scroll seems to be made before the preOpenStack message is generated; and

(2) a stack height set in a preOpenStack handler will not persist after the popped up stack has disappeared--so problem #1 will recur the next time you pop it up (see note below).

My experience is that it works best to set the popping stack's resizable property to false, thus making its minHeight and maxHeight settings irrelevant. When this was not true I got strange results.

Note regarding (2): If a stack's preOpenStack handler sets that stack's height, the effect of that command differs depending on whether the stack is opened with a topLevel command or a popup command. With a topLevel command, the height is set "permanently," i.e., until you do something to change it. With a popup command, the height is set "temporarily," i.e., the next time you pop it up or topLevel it the stack's height will be what it was before you tried to set it in this preOpenStack handler.

I hope these results may be found useful by others, and look forward to any corrections to them that others may discover.

David Epstein


on 11/3/02 11:14 AM, I wrote: >
> Does anyone understand how Metacard handles the size, positioning, and
> scrolling behavior of stacks when they are shown using a Popup command? For
> example:
>
> -- the objects in a popped up stack scroll up or down under circumstances
> that I cannot quite specify. It seems to happen when Metacard thinks the
> stack too tall for the screen, so it truncates a bit of the image and leaves
> a gray area that, when a depressed mouse enters it, causes the stack's
> objects to scroll.
>
> -- if I set the height of a stack, and then open it with a popup command,
> Metacard sometimes changes that height. This certainly happens when the
> height exceeds the screen's height, but also happens in other cases. The
> "maximum height" and "minimum height" properties also get adjusted.
>
> These behaviors may well be useful, but I need to know what to expect. I
> would like to pop up a panel whose position and height I can specify and
> whose controls will not scroll. Is there some height range within which I
> can do this?
>
> Many thanks.
>
> David Epstein
Posted 11/14/2002 to the MetaCard List    (See the complete thread)