How to share buttons and fields across cards

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
tlottrike@gmail.com
Posts: 6
Joined: Sun Jul 15, 2018 9:30 pm
Location: Edinburgh, Scotland

How to share buttons and fields across cards

Post by tlottrike@gmail.com » Sun Jul 15, 2018 9:51 pm

I have just started my first attempt at making something that would be useful for me in Livecode. I want to create a a sort of Song Rolodex.

I have made a Stack and I have added some cards to it. On the first Card I have added the Navigation widget and some Fields. However when I go to the next or previous Card in the Stack the Navigation bar and the Fields are not visible.

I have been looking at the Property Inspector and fiddling with things there but no luck.
Am I misunderstanding how things behave in Livecode?
Graeme

Mac iMac 2012
MacOS 10-15
Livecode 9_6_4

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: How to share buttons and fields across cards

Post by bogs » Sun Jul 15, 2018 10:41 pm

For the controls you want to show up on every card, you want to group them, then click the 'sharedBackground' property of the group.
Selection_003.png
Highlight all controls for the group...
Selection_003.png (4.25 KiB) Viewed 3368 times
Selection_005.png
Click 'Group'
Selection_005.png (9.36 KiB) Viewed 3368 times
Selection_006.png
Click 'backgroundBehavior' in properties...
Image

tlottrike
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 11
Joined: Mon Oct 31, 2011 3:46 pm
Location: Edinburgh, Scotland
Contact:

Re: How to share buttons and fields across cards

Post by tlottrike » Mon Jul 16, 2018 2:26 pm

Thanks for that.

I'm not sure why, initially when I did what you described it didn't work but once I deleted the second card and made a new card it did work.
Groupnotshowing.png
I have one further question but it is to do with scripting a Field so I will post it on the forum separately

Thanks again for your help
IMac MacOSX 10.13
Livecode 9.0.0 Build 15103

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: How to share buttons and fields across cards

Post by bogs » Mon Jul 16, 2018 3:44 pm

Glad I could help :)

In the case where it did not work, if the 2nd card was already existing when you grouped the controls and set the shared property, they wouldn't be placed on it automatically, only on new cards going forward. I don't know if that is what happened with your case, but it is the only thing I can think of off the top of my head.

In any case, glad it is working now.
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9579
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: How to share buttons and fields across cards

Post by dunbarx » Mon Jul 16, 2018 4:37 pm

Hi.

A group with backGroundBehavior set will be seen on all newly created cards. It will not, however, automatically appear on any pre-existing cards. You have two options:

1- Plan ahead, so that the group is created early. Then all new cards will be covered. I never do this. :D

2- Use the "place" command to add the group to any or all existing cards. This can be done under script control.

Craig Newman
Last edited by dunbarx on Mon Jul 16, 2018 8:20 pm, edited 1 time in total.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: How to share buttons and fields across cards

Post by jacque » Mon Jul 16, 2018 6:30 pm

Groups can also be placed manually via the "place group" menu item.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”