Noob Stacks Questions

Sarah Reichelt sarah.reichelt at gmail.com
Wed Feb 10 18:31:56 EST 2010


> I just added sarah's calender stack to my LeaseStack and trying to figure
> out how to get the information from sarah's calendar into my EditPayments
> card.

In the case of my calendar stack, it operates as a modal dialog and
uses the dialogData to pass information back & forth.
If you used the demo stack to install the calendar stack of your
choice in your stack, then the stack will be there. It will also have
added a function to your stack script that does the work for you. So
all you have to do to get a date from the calendar stack is to use:

  put getDate(tStartingDate, tStackName) into theDate
  if theDate is empty then exit to top

where tStackName = the name of your calendar stack (since there are 3
options, you have to supply this data)
and tStartingDate is the date you want the calendar to display when it
first opens. If this is empty, then it will display today's date.

If you check out the getDate function, you will see how it sets the
dialogData, then opens the calendar stack as modal, then retrieves the
dialogData. The calendar stack looks at the dialogData when it first
opens and uses that to set up it's display. Then when you select a
date, the calendar stack puts that date into the dialogData, so that
the calling function can get it back again.


While this is one way to transfer data between stacks, it really only
works for modal dialogs.
For other data transfers, you can use globals, or you can just specify
the full path to the object e.g.
  put field "Data" of stack "Stack1" into field "MoreData" of stack "Stack2"


With the issue of main stacks & sub stacks, there are (as always in
Rev) a couple of different possibilities.

You can have a main stack with everything else being a sub stack of
that. Note that you cannot have sub stacks of sub stacks, so in this
case, you would have to attach my calendar stack to the main stack.
The advantage of this method is that the development is all done on a
single file and Rev takes care of all the references, so you don't
need to worry about file paths - the stacks already know where they
are.

The other commonly used way is to have each stack as it's own
mainStack. Each stack is saved in a different file. You will have a
single stack that is the launcher stack and is the one that runs first
in your app. It will then have links to the other stacks. You can set
it's stackFiles so that it knows where the other stacks are, or you
can set the defaultFolder to the location of the other stacks and it
will find them that way.

You can always change from one to another, just taking into account
that you can't have sub-sub stacks. If a stack has no sub stacks of
it's own, then you can always change it's mainStack so it becomes part
of another stack file. If it has sub stacks, you need to change the
mainStack of every sub stack first. Just make sure you have backups
before you start messing with this as it is easy to save the wrong
thing.

Cheers,
Sarah



More information about the use-livecode mailing list