topLevel vs. open stack

Richard Gaskin ambassador at fourthworld.com
Wed Jan 14 14:29:57 EST 2004


Dan Shafer wrote:

> If I'm reading the docs correctly, topLevel should close a stack if
> it's open and then re-open it in an editable window UNLESS it is
> already open in an editable window, in which case it should merely make
> it the current stack. But there appears to me to be some subtle
> difference between sending "open" to a closed stack and sending
> "topLevel" to a closed stack.
> 
> Here's my basic demonstration.
> 
> Stack is open. It has a field 1 and a button. The button has a script
> that looks like this:
> 
> on mouseUp
> lock screen
> lock messages
> select field 1 of this stack
> copy
> topLevel stack "foo"
> paste
> unlock messages
> unlock screen
> end mouseUp
> 
> Clicking the button brings up stack "foo" in an editable window as
> documented but the paste never happens.
> 
> Simply change "topLevel" to "open" and the script works as expected.
> 
> If I begin with both stacks open, the result is identical.
> 
> So two questions arise:
> 
> 1. How if at all can I copy and paste objects between two open stacks?

  copy field 1 to stack "MyOtherStack"

The advantage to the "copy..to" option is that it preserves the user's
clipboard.

> 2. Why does topLevel behave differently from open and from the way it
> seems to be documented?

Could the stack's style property be set?  If so then "open" will honor the
style, while "toplevel" overrides the stack's style to open as toplevel
(same with the "palette", "modeless", and "modal" commands).

What is the mode of the stack when it's opened?

  open stack "foo"
  answer the mode of stack "foo"

-- 
 Richard Gaskin 
 Fourth World Media Corporation
 ___________________________________________________________
 Ambassador at FourthWorld.com       http://www.FourthWorld.com



More information about the use-livecode mailing list