Create button script won't work - why?

Bob Sneidar bobs at twft.com
Mon Nov 15 13:16:21 EST 2010


You cannot create a button "in" a card. The "in" keyword only works with a group. You have to actually go to the card you want to create a button on. To go to a card in a stack you don't want your user to see, simply open the stack invisible, then close it when you are done. You can always push card before you do this and pop card when you want to return. 

Bob


On Nov 14, 2010, at 5:22 PM, Bill Vlahos wrote:

> Make a new stack called "Test" and label the card "One".
> 
> Put a button on the card with the following script:
> on mouseUp
>   create button "Fred" in card "One" of stack "Test"
> end mouseUp
> 
> The compiler doesn't complain but when I click the button I get this error:
> button "Button": execution error at line 2 (create: error in bad parent or background expression), char 1
> 
> The following script works:
> on mouseUp
>   put the defaultStack into vName -- note whatever the defaultStack is
>   set the defaultStack to "Test"
>   go to card "One"
>   create button "Fred"
>   set the defaultStack to vName -- reset the defaultStack to what it was before
> end mouseUp
> 
> Is there a way to directly create a button on a particular card in a particular stack without going to it and doing all this? The stack I want to create the button into is data stack that never gets viewed directly. In this case it will be data in the custom property of that button.
> 
> Thanks,
> Bill Vlahos
> _________________
> InfoWallet (http://www.infowallet.com) is about keeping your important life information with you, accessible, and secure.
> 
> _______________________________________________
> 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