Search code examples
commandmessagelivecodehypercard

How do I create a new card in another stack?


I have a script in a stack called "loader" and I want to create a new card in another stack called "theData". If I just use create card the cards are created in the stack "loader". How do I specify that the new card is created in the stack "theStackName"?

Something like

on mouseUp
   put field "theStackName" into tStack

   create stack tStack with background "BGdata"
   -- the background "BGdata" which has been defined before
   -- contains a field "data"

   set the defaultStack to tStack

   put "something" into field "data"

   create card
   put "somethingElse" into field "data" 
end mouseUp

Solution

  • A few ways to do this, all using the create card command.

    Method 1

    You can navigate to the target stack, perhaps locking the screen so that nothing changes visibly, and create the card there. This has the advantage of being able to create the new card anywhere in the target stack, which might already have several cards. You can then always return to your starting place, if you want to.

    or you can:

    Method 2

    set the defaultStack to "theData"
    create card
    

    Sort of the same thing.