I have 3 buttons with scripts for each that navigate respectively through 3 different cards
(button 1 goes to card 1, button 2 to card 2, etc).
I would like to have these 3 buttons along all 3 cards.
The issue is this:
I can copy the buttons to each card, but if I later make changes to the code of style of the button on card one, it won't copy those changes to all of the card buttons.
Is there a way to create reusable components (such as buttons), where I create it once and drag it to the different cards, and one change will change them all?
If not, what is the best practice for creating reusable components (such as buttons) that accomplishes what I'm seeking (efficiency).
Thanks!
Navigating Cards with Reusable Buttons
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- VIP Livecode Opensource Backer
- Posts: 9670
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Navigating Cards with Reusable Buttons
Hi.
Yes.
Two experiments:
1- In a new stack, drag three buttons onto the card. Select them all and group them. Select "backGroundBehavior" in the property inspector for the group.
Now make a new card. The group appears there, and on every new card you make.
2- If you already have objects, then group them, and use the "place" command to create a copy on any card you want to. Read up on the "place" command, you will see that simply using it automatically sets the backGroundBehavior property.
The real lesson here is to plan, as best you can, in advance. I never do.
Craig Newman
Yes.
Two experiments:
1- In a new stack, drag three buttons onto the card. Select them all and group them. Select "backGroundBehavior" in the property inspector for the group.
Now make a new card. The group appears there, and on every new card you make.
2- If you already have objects, then group them, and use the "place" command to create a copy on any card you want to. Read up on the "place" command, you will see that simply using it automatically sets the backGroundBehavior property.
The real lesson here is to plan, as best you can, in advance. I never do.
Craig Newman
Re: Navigating Cards with Reusable Buttons
Amazing! Thank you so much, Craig!
Yup, I too am also very bad a planning ahead, so I'm trying to do my best as I port an old project over to LiveCode.
This information is gold though, and I'm really surprised it hasn't been featured in any lessons,etc.
There really should be a educational portion for "Planning your project" that gives best practices such as this.
Yup, I too am also very bad a planning ahead, so I'm trying to do my best as I port an old project over to LiveCode.
This information is gold though, and I'm really surprised it hasn't been featured in any lessons,etc.
There really should be a educational portion for "Planning your project" that gives best practices such as this.