Creating reusable code libraries

Frank D. Engel, Jr. fde101 at fjrhome.net
Mon Nov 22 09:37:12 EST 2004


On Nov 21, 2004, at 12:36 PM, <gwalias-rev at yahoo.com> wrote:

> I am still a little unclear on the relationship of
> stacks, substacks and cards. Supposing I have created
> a mainstack already - what is the difference between
> adding a new card to the mainstack or adding a new
> substack? Stacks and substacks both have to have at
> least one main card - yes? How is the relationship of
> a substack to its stack, different from that of a card
> to its stack (or substack)?

Okay, so far these explanations have seemed unclear to me (I don't 
think I would have understood them if I didn't already know the 
answer).  So here goes...

Think of a "card" as a page from a book.  Each page can have different 
text or pictures on it.  In the case of hypermedia software (like Rev), 
a card can also have fields, buttons, and the like.  Each card is a 
distinct page.

A "stack" then would be a book.  Each stack can have one or more cards 
(pages), but only one card may be viewed at a time.  You can switch 
from one card to another, much as you would flip from one page of a 
book to another.  So let's say you are writing a 
choose-your-own-adventure book in Rev.  You can do this super-easily 
using a single stack.  For the first card in your stack, you might have 
a title card (like the title page of a book).  Then put a button on the 
card to flip to the next card (page) using a command like "go to next 
card".  You can add more cards to the stack to fill in additional 
"pages" of the book, and have buttons which switch to different pages.  
Since all of the cards are in the same stack, you can only view one 
card at a time, and as you switch cards, they take over the window.

The window is owned by the stack, and exactly one card from a stack is 
displayed at any given time while the stack's window is opened.  One 
stack = one window.  The window can be displayed in any of several 
different formats, including topLevel, modeless, modal, sheet, drawer, 
and palette (possibly others that I am not thinking of right now).  
These are different "styles" which can be applied to the window.

In order to display several windows at a time, you need several stacks 
-- one for each window.  Each stack has one or more cards (pages), but 
is essentially a separate "book," distinct from the other stacks.

A stack file in Rev consists of one or more stacks.  Exactly one of 
those stacks is considered the "main stack" of the stack file, and has 
some level of influence over the other stacks.

That main stack receives any messages sent to its "substacks" (any 
stacks in the same file as the main stack, other than the main stack 
itself), unless the substacks handle the messages and do not pass them 
along.  This is part of the way inheritance works under Rev.


-----------------------------------------------------------
Frank D. Engel, Jr.  <fde101 at fjrhome.net>

$ ln -s /usr/share/kjvbible /usr/manual
$ true | cat /usr/manual | grep "John 3:16"
John 3:16 For God so loved the world, that he gave his only begotten 
Son, that whosoever believeth in him should not perish, but have 
everlasting life.
$



___________________________________________________________
$0 Web Hosting with up to 120MB web space, 1000 MB Transfer
10 Personalized POP and Web E-mail Accounts, and much more.
Signup at www.doteasy.com



More information about the use-livecode mailing list