[comp.sys.mac.hypercard] How many cards to pop?

sirkm@ssyx.ucsc.edu (Greg Anderson) (07/14/89)

Some of my stacks have buttons that take the users to other cards;
the destination cards are usually equipt with a "Return" button
which simply does a "pop card" to bring the user back to where he
came from.

However, the user is not obligated to use the return button; he might
instead go back to the home stack & completely forget about what
he was doing before.  This would leave some unwanted garbage on the
"pop card" stack.

Is there any way to determine how many cards are pushed on the stack?


     ___\    /___               Greg Anderson              ___\    /___ 
     \   \  /   /         Social Sciences Computing        \   \  /   /
      \  /\/\  /    University of California, Santa Cruz    \  /\/\  /
       \/    \/              sirkm@ssyx.ucsc.edu             \/    \/

stone@grumpy.cs.unm.edu (Andrew Stone) (07/18/89)

In article <8355@saturn.ucsc.edu> sirkm@ssyx.ucsc.edu (Greg Anderson) writes:
[explanation deleted]
>However, the user is not obligated to use the return button; he might
>instead go back to the home stack & completely forget about what
>he was doing before.  This would leave some unwanted garbage on the
>"pop card" stack.
>
>Is there any way to determine how many cards are pushed on the stack?


I have found it best to maintain your own data structure, a list,
PushList, and push cards' id onto the global list: in the opencard handler.

Then if the user hits the "Go Back", you access your global list. If you
created a queue, that is, add the newcard at the end of the list, you could
access the count by "the number of items in PushList". If this function
returns 0, there is nowhere to go.

On closecard, do what ever cleanup is necessary to follow your stack's
logic.

Hope this is of use.

andrew  [kind of sick of wasted .sig space....]