Card id and button problem

Rob Cozens rcozens at pon.net
Tue Jun 29 19:35:35 EDT 2004


Hi Lars,

>the button that creates the new card in the drawer stack looks like this
>
>   open stack "buttons"   --  this is a substack that contains the 
>buttons I use


>   copy btn id xxxx to stack "MainStack"  -- this is now in front of 
>(and thus hides) the "new card" button

According to the Rev Dictionary (Copy), "if stack is specified, the 
copied object must be a card"

so you need to

     "copy button id xxxx to card [cardReference] of stack "Main Stack"

followed by

     "put it into newButtonId" -- it contains new button id

>   close stack "buttons"
>   open stack "Y"  -- this is the drawer stack
>   create card

now,

     set the drawerCardId of button id newButtonId of card 
[cardReference] of stack "Main Stack" to it -- it contains new card id

>[snip]


>So far it all works.  The button on the main stack card that should 
>lead back to this drawer card is:
>
>   drawer stack "Y" at bottom aligned to center
>   go card id zzzz of stack "Y"
>
>Is it possible to take the short id of the new drawer card and put 
>it in place of the zzzz in the button script on that specific card 
>in the main stack? This is what I don't know how to do.

replace

     go card id zzzz of stack "Y"

with

     go to card id (the drawerCardId of me) of stack "Y"

in the script of button id xxxx of stack "Buttons"

>Suggestions?

This logic does not require any change to the script of the new button.
-- 

Rob Cozens
CCW, Serendipity Software Company

"And I, which was two fooles, do so grow three;
Who are a little wise, the best fooles bee."

from "The Triple Foole" by John Donne (1572-1631)


More information about the use-livecode mailing list