main stack and substack questions

Jim Ault JimAultWins at yahoo.com
Fri Mar 30 19:23:23 EDT 2007


Another way I like better is to avoid globals and...

on mouseup
   set the lockRecent to false  --precaution in case true
   go to stack "sub2"
    put char 2 to -2 of word -1 of the long name of recent card into stkFrom
    put the short name of recent card into cdFrom
    put fld "newrecord_id" of cd cdFrom of stk stkFrom into fld "record_id"

    put the short id of recent card into cdIDFrom  --recommended
    -- in case of duplicate card names
    put fld "newrecord_id" of cd id cdIDFrom of stk stkFrom /
         into fld "record_id"
end  mouseup

Jim Ault
Las Vegas

On 3/30/07 3:11 PM, "Sarah Reichelt" <sarah.reichelt at gmail.com> wrote:

>> But I would like to click a button in substack 1 to open substack 2 and when
>> I click the button pass name of substack 1 and the card name that is
>> currently open to substack 2 so that I am able to get info from flds within
>> open card in substack 1, I hope this explains it better?
> 
> OK, I get it now. The simplest way might be to use global variables.
> 
> In your button on substack 1, have this script:
> 
> on mouseUp
>    global gStack, gCard
>    put the short name of this stack into gStack
>    put the short name of this card into gCard
>    go to stack "sub2"
> end mouseUp
> 
> Then in the card or stack script of 2:
> 
> on openCard
>    global gStack, gCard
>    put fld "newrecord_id" of card gCard of stack gStack into fld "record_id"
> end openCard
> 
> 
> This method gives you access to that card & stack any time, but if you
> only need to get the data once, then you could just put the data into
> substack 2 before going to it e.g.
> 
> on mouseUp
>   put fld "newrecord_id"  into fld "record_id" of stack "sub2"
>   go to stack "sub2"
> end mouseUp
> 
> Cheers,
> Sarah
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution





More information about the use-livecode mailing list