Create button script won't work - why?

Bill Vlahos bvlahos at
Sun Nov 14 20:22:51 EST 2010

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.

Bill Vlahos
InfoWallet ( is about keeping your important life information with you, accessible, and secure.

More information about the Use-livecode mailing list