defaultStack Scope

Richard Gaskin ambassador at
Sat Jul 13 14:06:01 EDT 2002

Dan Shafer asks:

>> Appears to me, it's the last non palette stack to have focus. So, changing
>> focus of a stack makes it the defaultStack.
> Which I think explains what I'm seeing. Message Box is a stack. So
> when I type into it, it changes the defaultStack I just set? But it
> goes to the topStack, which isn't message box because it's a palette?
> So what am I not getting?

Modeless windows.

Rev windows can be opened as toplevel, palette, modal, and modeless.

Toplevel has the standard document window behavaviors normally associated
with modern GUIs.   The topstack returns the top-most window of this type,
and changes in interaction mode ("the tool") are reflected in these windows.

Palette is a floating utility window.  These are not returned by "the
topstack" unless no toplevel windows are open, and are impervious to changes
in the user interaction mode (indeed, such changes are usually triggered by
the user's selection of tools in such windows).

Modal is a modal dialog.  These are brought in front of other windows for
situations requiring brief and immediate attention of the user.  While
displayed the script that called it is suspended.  These windows are also
impervious to changes in the user interaction mode.

Modeless windows appear and behave like toplevel, except that such windows
are only returned by "the topstack" only when no toplevel window is open,
and are  impervious to changes in the user interaction mode.  This type
allows property sheets and other utility window designs where it would not
be desirable to have them float above other windows as with palettes, or
suspend activity as with dialogs.

Consider the document-centric philosophy behind the design of modern GUIs
(one could argue that modern GUIs are application-centric, but that's
looking at the larger OS context; here I'm thinking only of the context
within an application):

The document window ("toplevel") is the focal point of interaction.  It
holds the user's data, and accordingly it responds to the user's choice of
"tool" (interaction mode) and is the default focus for keyboard and mouse

All other window types are secondary to the document, serving to support
activities taking place in the document window.

Ideally the designs of non-document windows reinforce this visually, making
the document the visual focal point of the layout.  This is why, for
example, OS X draws document windows with a white background while other
window types are drawn with the pinstripe background, helping them visually
recede and making the document stand out in bright contrast to them.  Less
automatic in Rev, this is also reflected in the Win32 convention of having a
document's content region drawn white while the content region of secondary
windows are gray.

Revolution's modeless windows simply give us another type of secondary
supporting window for those cirumstances where a palette or modal dialog
would be inappropriate or at least suboptimal.

Rev's Message Box is able to transfer focus of the execution of its contents
by simply shifting the defaultstack property to the topstack:

  set defaultStack to the topStack

 Richard Gaskin 
 Fourth World Media Corporation
 Custom Software and Web Development for All Major Platforms
 Developer of WebMerge 2.0: Publish any Database on Any Site
 Ambassador at
 Tel: 323-225-3717                       AIM: FourthWorldInc

More information about the Use-livecode mailing list