Adding radio buttons

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

exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

Adding radio buttons

Post by exheusden » Sun Dec 27, 2009 12:32 am

After a lapse, I am back to testing RevMedia 4.0.

I had made a project, containing several cards. Now I have decided that I should add a group of radio buttons. Thinking the HC and SC way, I'd go to the background, add the buttons, and that would be that (other than any necessary scripting, of course): all the buttons would be available on all of the cards that shared that background.

In RevMedia I tried adding three radio buttons, grouping them and marking the group to "Behave as background", though worried about the comment in parentheses by this check-box, "Auto-place on new cards…" (my italics): only on new cards?

Indeed, when I look at other cards in the project, they do not contain the new group of radio buttons.

Must new "background" elements be added separately, either manually or through a script, to each existing card?

Klaus
Posts: 14192
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Adding radio buttons

Post by Klaus » Wed Dec 30, 2009 7:06 pm

Hi exheusfden,
In RevMedia I tried adding three radio buttons, grouping them and marking the group to "Behave as background", though worried about the comment in parentheses by this check-box, "Auto-place on new cards…" (my italics): only on new cards?
Yes, this applies only to newly created cards!
AND the group must be on the current card when the new card is being created!
Must new "background" elements be added separately, either manually or through a script, to each existing card?
Yes.
...
place bg "name of new background group here" onto cd 1
...


Best

Klaus

exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

Re: Adding radio buttons

Post by exheusden » Wed Dec 30, 2009 7:48 pm

Thanks Klaus. That's very disappointing and a huge drawback when compared to the "classic" background use of HC and SC. Good to know before I get too far into Revolution, though.

exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

Re: Adding radio buttons

Post by exheusden » Wed Dec 30, 2009 9:10 pm

Klaus wrote:
Must new "background" elements be added separately, either manually or through a script, to each existing card?
Yes.
...
place bg "name of new background group here" onto cd 1
...
And can the new group be added to an existing group, so that the resulting group applies to all cards?

Klaus
Posts: 14192
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Adding radio buttons

Post by Klaus » Sat Jan 02, 2010 4:06 pm

Hi exheusden,

yes, if you add objects to groups that are already placed onto cards, then these cards will of course reflect the changes you made!


Best

Klaus

exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

Re: Adding radio buttons

Post by exheusden » Mon Jan 04, 2010 11:55 am

Klaus, I've been trying to work out this business of adding objects to groups. Indeed, the Revolution Users Guide states
you can add objects to the group or
delete them
but I am unable to find any explanation in the guide as to how to actually add an object. Suppose, for example, that I want to add a single button to a large, already existing group: what's the best way to do this?

Klaus
Posts: 14192
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Adding radio buttons

Post by Klaus » Mon Jan 04, 2010 1:02 pm

1. Select the group where you want to add an object to.
2. Menu "Object" -> Edit group...
(this switches to a special "edit background" mode! Note the change of the windows title!)
3. Add or delete objects to the group
4. Menu "Object" -> Stop editing group

Done :)


Best

Klaus

exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

Re: Adding radio buttons

Post by exheusden » Mon Jan 04, 2010 3:48 pm

Thank you, Klaus!

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Adding radio buttons

Post by dunbarx » Tue Jan 05, 2010 12:41 am

My little development tool, "wizard" does this. You select the group, and it places it on all cards, changing its backgroundbehavior along the way. It's in revOnLine.

Craig Newman

exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

Re: Adding radio buttons

Post by exheusden » Tue Jan 05, 2010 10:48 am

Craig, just testing Wizard and it returns the error
field "doStuff": execution error at line 16 (do: error in source expression) near "send resumeStack to ", char 1
in the mouseUp script of field "doStuff".

Perhaps I have an incompatible version of Revolution.

Klaus
Posts: 14192
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Adding radio buttons

Post by Klaus » Tue Jan 05, 2010 1:58 pm

You do not have an incompatible version of Rev!

Problem lies in the scripts of that "Wizard".
If you call/send an handler that is not defined, like "resumestack" to a stack that has NO "resumestack" handler in the message hierarchy, then you get an error!

@Craig
Change all these scripts to a "try" structure and it should work.


Best

Klaus

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Adding radio buttons

Post by dunbarx » Tue Jan 05, 2010 4:46 pm

Hi.

The "wizard" stack is only meant to be used in conjunction with other "working" stacks, never alone. A new download might not have references to anything right out of the box, and errors might pop up if you try to invoke certain functions. Open a stack, and then click wizard. It will track you from that point on. This was my personal tool in HC, and it has no value alone.

The "resumeStack" message is trapped and passed normally, whenever it arises. Klaus, the error comes from not having a valid destination to send the message to, not that the message cannot be handled. I should, however, test for the case when there is no open stack for wizard to track. I just never used in that way.

Also, I should point out that only groups will be added to all cards, not just any old object. I should change this to encompass individual objects as well.

Craig

Klaus
Posts: 14192
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Adding radio buttons

Post by Klaus » Tue Jan 05, 2010 6:31 pm

Hi Craig,

ah, I see, sorry, I was just guessing from what exheusden wrote :-)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Adding radio buttons

Post by dunbarx » Tue Jan 05, 2010 8:43 pm

Klaus.

No foul; I actually figured as much, knowing your capabilities. I did add a check to make sure there are valid object references, so it was worth it after all.

And one can now make both objects and/or groups into a bg object, which was an oversight.

I agree with exheusden about the background paradigm from HC, though I am slowly getting the group paradigm. It is hard to change one's second nature. That a stack could be partitioned by bg still seems like a fabulous functionality. Anyway, that is exactly why I made that gadget.

Exheusden, please try it once more, with the latest version. As I learned yet again, you cannot test too much...

Craig

exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

Re: Adding radio buttons

Post by exheusden » Tue Jan 05, 2010 11:51 pm

Craig, just tried Wizard again and received another error:
field "Objects": execution error at line 39 (Chunk: error in object expression) near "btn btn "One", char 13
This time in the mouseUp script of field "Objects".

This time I opened my own stack after having opened (downloaded) Wizard.

I am, in any case, glad to hear that I'm not alone in finding the bg notion easier to use than that of groups. Perhaps it's just what one is used to.

Post Reply