For future newbie:
Create a new stack. It's name should be "KARD1". Put this in the script of a button.
Code: Select all
if exists (card "theNewCard") then delete card "theNewCard"
create card "theNewCard"
create button "theNewbutton"
set the style of button "theNewButton" to roundRect
set the script of button "theNewButton" to \
"on mouseUp" & CR \
& "go to card" && QUOTE \
& "KARD1" & QUOTE & CR \
& "end mouseUp"
The stack has one card as a standalone when launched. It creates a card on the fly with a button and the above script. You can see that you can set properties of controls in script (see theNewButton above). The button navigates back to the original card of the stack "KARD1". The next time that the button on "KARD1" is clicked, there will be a card called "theNewCard" and it will be deleted before a new card is created.
If in the app, I use a template card that I can clone, rename, add labels to buttons, add content to fields and add scripts to controls then delete the card when finished with it, then the final version of the app will be so much smaller in size (memory).
OK. Enough for this theory. On to another subject where I will probably need help and or guidance.
Oops. One more thing about the syntax of the script above.
In the first line of the on mouseUp, I have to use parenthesis around (card "theNewCard) when it is after "if exists" but NOT around it when it comes after "delete card". What is the difference?