Card id and button problem

Sarah Reichelt sarahr at genesearch.com.au
Tue Jun 29 19:32:49 EDT 2004


When you create the new button, store it's ID.
Then when you create the new card, get it's ID or set it's name.
Then set a custom property of the new button to that card ID or name.
In the button script, have a line that retrieves that custom property 
and uses it as the destination.

something like this (adding lines to your script):

>   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
put the ID of the last button into newButtonID
>   close stack "buttons"
>   open stack "Y"  -- this is the drawer stack
>   create card
put it into newCardID
set the cDestinationCard of btn ID newButtonID of stack "MainStack" to 
newCardID

Then in the script of the "Open" button:

put the cDestinationCard of me into tCardID
>   drawer stack "Y" at bottom aligned to center
go to card ID tCardID of stack "Y"

This is all untested, but the idea should be enough to get you started.

Cheers,
Sarah
sarahr at genesearch.com.au
http://www.troz.net/Rev/

On 30 Jun 2004, at 6:32 am, Lars Brehmer wrote:

> Hi All!
>
> I've been searching searching the archives for hours, but since I 
> don't really know what I'm doing, I guess I don't know what to search 
> for!  Here's the problem/question:
>
> I have a stack with a substack drawer.  When a new card is created in 
> the main stack, there is a button on it that creates a new card in the 
> substack, unlocks its text fields and opens it in the drawer.  The 
> button in the main stack that created the new card in the substack is 
> then hidden behind another new button that should later open the 
> drawer to that same card.  Once the fields on the drawer card are 
> filled in, there is a button on it that locks the fields and saves the 
> drawer stack.  The problem is that I need that save button also to put 
> the short card id of the drawer card into the script of the main stack 
> button that will re-open it.   This is what I can't figure out.  It 
> looks like this:
>
> 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
>   close stack "buttons"
>   open stack "Y"  -- this is the drawer stack
>   create card
>   repeat with i = 1 to 33
>     set the lockText of field ("Field" & i) to false
>   end repeat
>   close stack "Y"
>   drawer stack "Y" at bottom aligned to center -- this reopens the "Y" 
> stack in the drawer
>
>
> The new drawer card is now open and the fields can be filled in.  The 
> save button on this card is:
>
>   repeat with i = 1 to 33
>     set the lockText of field ("Field" & i) to true
>   end repeat
>   save stack "Y"
>   close stack "Y"
>
> 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.
>
> Suggestions?
>
> Thanks,
>
>
> Lars



More information about the use-livecode mailing list