Buttons and backgrounds

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Judson
Posts: 26
Joined: Fri May 07, 2010 9:15 pm

Buttons and backgrounds

Post by Judson » Sat Jul 31, 2010 9:07 pm

Okay, so I'm confused:

1) How do I add a button to a background? In hypercard I cut the button onto the clipboard, do a command-B, paste, and command-B again. And yes, I've read the manual. This can't be that hard.

2) In Hypercard the stack has one background which is common to all cards. Now the number of background is growing. I don't want a bunch of backgrounds, just one.

How do I "go next background"? Or find all these strays to track them down and purge them?

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Buttons and backgrounds

Post by Mark » Sat Jul 31, 2010 10:01 pm

Judson,

Forget HyperCard. RunRev is competely different. It has many features that you wouldn't even want in HyperCard and backgrounds are actually called groups and work differently.

To edit a group, uncheck "Select grouped controls" in the Edit menu and click on the group. Now choose Edit Group from the Objects menu. Now you can add any objects you want. Choose Stop Editing Group when you're done.

You can go to the next card but not to the next group.

You can put groups in the message hierarchy after cards, like in HyperCard, by setting the backgroundBehavior of the group to true. This just changes the message hierarchy and adds the group automatically to any new cards, thereby mimicking HyperCard backgrounds.

Best regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Judson
Posts: 26
Joined: Fri May 07, 2010 9:15 pm

Re: Buttons and backgrounds

Post by Judson » Sat Jul 31, 2010 11:26 pm

To edit a group, uncheck "Select grouped controls" in the Edit menu.

DONE.

and click on the group.

NOT SURE WHAT THAT MEANS. I HAVE THE TOOL CURSOR IN THE EDIT MORE, NOT THE OPERATE MODE.

Now choose Edit Group from the Objects menu.

THIS IS GRAYED OUT, SO I AM UNABLE TO FOLLOW FURTHER. ???

Now you can add any objects you want. Choose Stop Editing Group when you're done.

Curry
Posts: 111
Joined: Mon Oct 15, 2007 11:34 pm
Location: USA
Contact:

Re: Buttons and backgrounds

Post by Curry » Sat Jul 31, 2010 11:34 pm

If you use cut and paste, consider saving and backing up beforehand.

To clean up multiple backgrounds and create one, assuming the background on each card will contain the same controls and that you have existing cards with other objects you want to retain:

(First save and back up.) Edit one of the backgrounds per Mark's instructions, use the Inspector to ensure that it will behave as a background, and on any other existing cards carefully delete unwanted backgrounds, then use menu Objects >> Place Group >> (Your background name) to add the one. On new cards the background will be automatically added.

You can also have multiple shared or different backgrounds on each card. Mix and match. It really is more powerful than HyperCard!
Best wishes,

Curry Kenworthy

LiveCode Development, Training & Consulting
http://livecodeconsulting.com/

WordLib: Conquer MS Word & OpenOffice
SpreadLib: "Excel-lent" spreadsheet import/export
http://livecodeaddons.com/

Curry
Posts: 111
Joined: Mon Oct 15, 2007 11:34 pm
Location: USA
Contact:

Re: Buttons and backgrounds

Post by Curry » Sat Jul 31, 2010 11:36 pm

and click on the group.
NOT SURE WHAT THAT MEANS. I HAVE THE TOOL CURSOR IN THE EDIT MORE, NOT THE OPERATE MODE.
Select the group. To make it easy: right click on any object in the group and choose "Edit group" from the contextual menu.
Best wishes,

Curry Kenworthy

LiveCode Development, Training & Consulting
http://livecodeconsulting.com/

WordLib: Conquer MS Word & OpenOffice
SpreadLib: "Excel-lent" spreadsheet import/export
http://livecodeaddons.com/

Judson
Posts: 26
Joined: Fri May 07, 2010 9:15 pm

Re: Buttons and backgrounds

Post by Judson » Sat Jul 31, 2010 11:57 pm

Okay, thanks for the guidance but this is not working yet.

I uncheck Edit>Group

I go into the editing, not operational cursor.

I copy the button I want to paste into the group.

I click on the group.

I click "Place Group" and the stack I'm in.

And that doesn't work.

I have one button I want to paste into one group which is shared with all 28,000 cards in the stack.

Curry
Posts: 111
Joined: Mon Oct 15, 2007 11:34 pm
Location: USA
Contact:

Re: Buttons and backgrounds

Post by Curry » Sun Aug 01, 2010 12:02 am

No, for that step do as Mark said. First copy that button, then edit group, then paste, then stop editing.

The "Place Group" is for later, to put that group on different cards. But if you already have 28,000 cards you will want to automate this! Feel free to contact me if you need assistance getting the stack cleaned up. Definitely make sure you save and back up (create a duplicate of the stack file) before doing anything further.
Best wishes,

Curry Kenworthy

LiveCode Development, Training & Consulting
http://livecodeconsulting.com/

WordLib: Conquer MS Word & OpenOffice
SpreadLib: "Excel-lent" spreadsheet import/export
http://livecodeaddons.com/

Curry
Posts: 111
Joined: Mon Oct 15, 2007 11:34 pm
Location: USA
Contact:

Re: Buttons and backgrounds

Post by Curry » Sun Aug 01, 2010 12:06 am

(To clarify: adding the button to the group would make it appear on all 28,000 cards if your group is already on all the cards. That's the whole idea! But if you have a number of different unwanted backgrounds on cards, or some cards without the wanted background, then it will take further work to clean things up.)
Best wishes,

Curry Kenworthy

LiveCode Development, Training & Consulting
http://livecodeconsulting.com/

WordLib: Conquer MS Word & OpenOffice
SpreadLib: "Excel-lent" spreadsheet import/export
http://livecodeaddons.com/

Judson
Posts: 26
Joined: Fri May 07, 2010 9:15 pm

Re: Buttons and backgrounds

Post by Judson » Sun Aug 01, 2010 2:46 am

Okay, I think I got it, sort of. Thank you both Mark and Curry.

But in the process I think that some of the cards I created seem to have (identical looking) but different backgrounds (groups).

Don't worry about the backup business; I've been doing this kind of thing a long time.

In HC it is also possible to get spurious backgrounds into a stack (for example if a button toggles), but with "next background" one can find them.

I think they are getting created here in a "copy this card" into message followed by a "paste".

1) Is there a recommended method to copy and paste a card?

2) Is there an equivalent of "go next background" so I can root out the miscreants?

All the spiffy features are great, but my needs at the moment are very pedestrian.

Judson

Curry
Posts: 111
Joined: Mon Oct 15, 2007 11:34 pm
Location: USA
Contact:

Re: Buttons and backgrounds

Post by Curry » Sun Aug 01, 2010 3:09 am

One way to find the baddie backgrounds is a script that looks for the absence of the good group (perhaps referenced by the good group's ID rather than its name) on each card. (Assuming the miscreants are on cards where the good one is missing.)
Best wishes,

Curry Kenworthy

LiveCode Development, Training & Consulting
http://livecodeconsulting.com/

WordLib: Conquer MS Word & OpenOffice
SpreadLib: "Excel-lent" spreadsheet import/export
http://livecodeaddons.com/

Judson
Posts: 26
Joined: Fri May 07, 2010 9:15 pm

Re: Buttons and backgrounds

Post by Judson » Sun Aug 01, 2010 3:12 am

Curry I will try the script approach to look for bad backgrounds.

But what about the first question: Is there a way to copy and paste cards within a stack without creating a new group/background?

Curry
Posts: 111
Joined: Mon Oct 15, 2007 11:34 pm
Location: USA
Contact:

Re: Buttons and backgrounds

Post by Curry » Sun Aug 01, 2010 3:17 am

Try "clone this card"

But--I doubt it matters on the syntax. Probably it was a matter of duplicating those cards BEFORE/WITHOUT setting the group to behave as a background. That will create a new (miscreant) identical group rather than placing the same group.
Best wishes,

Curry Kenworthy

LiveCode Development, Training & Consulting
http://livecodeconsulting.com/

WordLib: Conquer MS Word & OpenOffice
SpreadLib: "Excel-lent" spreadsheet import/export
http://livecodeaddons.com/

Judson
Posts: 26
Joined: Fri May 07, 2010 9:15 pm

Re: Buttons and backgrounds

Post by Judson » Sun Aug 01, 2010 3:37 am

Lets see then:

Trial 1

Menu: Edit uncheck Select Group Controls
Message Box: copy this card
Go to where to put in.
Change cursor to editing cursor
Select the group by clicking on the screen
Menu: Edit Paste Objects

This successfully pastes in a new card, a copy of what is in all the fields, but it also seems to create a new grouping. I can tell this by Selecting Group Controls, moving the position of a button, and the position moved is unique to this card. So there is some part of your solution I'm not working correctly.

Trial 2

Menu: Edit uncheck Select Group Controls
Message Box: copy this card
Go to where to put in.
Change cursor to editing cursor
Select the group by clicking on the screen
Menu: Object Edit Group
Menu: Edit Paste Objects

This crashes Revolution

Judson
Posts: 26
Joined: Fri May 07, 2010 9:15 pm

Re: Buttons and backgrounds

Post by Judson » Sun Aug 01, 2010 3:54 am

I just tried the

clone this card

That's very sweet and I'm sure I will use it a lot.

But it is still frequently necessary to copy a card, move it someplace, and then change it around some.

Curry
Posts: 111
Joined: Mon Oct 15, 2007 11:34 pm
Location: USA
Contact:

Re: Buttons and backgrounds

Post by Curry » Sun Aug 01, 2010 4:02 am

That's good.

But about the previous message, Trial 1 and Trial 2: Hold on there, pardner! Sorry, but I think you're putting completely different things together. First, slow down and make sure you understand these new concepts. Editing groups and copying and pasting cards are not related. In Revolution, groups contain only controls, not cards. Groups can be placed on cards, but you can't place cards in groups.

If you want to add some controls to a group, select and copy the controls (not the card) and then edit a group to paste them in.

If you want to add a card with a group, you could duplicate the card or simply create a new card, but either way you need background behavior enabled for your group beforehand. (However, you can always add or remove groups later on. The problem is if you duplicate a card without the group set for background behavior and end up with multiple identical groups.)

If you want to copy cards elsewhere and modify them some, just copy and paste the card; don't do any of the group-editing procedures.

I'm not sure which of these you are trying to accomplish now. First get these concepts firm, then you'll be able to follow the instructions from myself and Mark and choose the best methods to pursue. (If you get stuck, I can help you clean up your stack if you follow the link below to my contact information!)
Best wishes,

Curry Kenworthy

LiveCode Development, Training & Consulting
http://livecodeconsulting.com/

WordLib: Conquer MS Word & OpenOffice
SpreadLib: "Excel-lent" spreadsheet import/export
http://livecodeaddons.com/

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”