Number of button families?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Timothy
Posts: 78
Joined: Tue Apr 11, 2006 7:38 pm

Number of button families?

Post by Timothy » Thu May 04, 2006 6:56 pm

I want to put a new family of radio buttons on a background. There are already several families of radio buttons on this background. I want to set the family number for the new buttons to the appropriate value, which would be one higher than the highest number for the existing radio button families. Setting the number two low could produce undesirable results, to say the least.

Is there any way to "get the number of button families of this bg"? What's the right syntax?

Oh, jeez. I just placed two new radio buttons on the background. I haven't set a family number, but the two new buttons are acting as one family. What happened?

There must be something I don't understand. Strange... that never happened before... :)

Thanks in advance,


Tim

mcgrath3
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 149
Joined: Thu Feb 23, 2006 8:49 pm
Location: Bethel Park, Pittsbrugh, Pennsylvania USA
Contact:

Post by mcgrath3 » Thu May 04, 2006 7:14 pm

Tim,

There are two ways of dealling with families of buttons.

The first is to create a radio-button cluster by putting them in a group and setting that groups background behavior to true.

Or group an already created set of them and set that groups behavior to true. Now they are one big happy family

The family property is from Hypercard and is only used in RR for Radio buttons for compatibility.

Have you tried a repeat loop sorta like this:
repeat with x = 1 to the number of btns
put the family of button x
end repeat
Tom McGrath III
Lazy River Software
3mcgrath@comcast.net

Timothy
Posts: 78
Joined: Tue Apr 11, 2006 7:38 pm

Post by Timothy » Thu May 04, 2006 8:29 pm

Hi mcgrath,

I just experimented with some test buttons. RR seems to ignore "set the family of me to <some integer>" but does not generate an error message. I didn't know that. That would explain some mysterious phenomena I've previously encountered.

Does RR respond correctly to family numbers that were set in a HC stack before being converted to RR?

Is it reasonable to place a group of radio buttons on top of the existing background? Can I set "behave like a background" to true for each group of radio buttons? This sounds dicey, but maybe it isn't. I'm a hyperCard retread, so backgrounds on top of backgrounds is unfamiliar.

The alternative isn't that bad. I can always script the hilite behavior of radio buttons to my liking. It's more tedious than button family numbers, and creates some maintanance problems, but it's not the end of the world.

Families for radio buttons and check boxes was a handy hyperCard feature. I suppose there is a good reason RR eliminated it, though I can't think of one.

Thanks again,

Tim

mcgrath3
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 149
Joined: Thu Feb 23, 2006 8:49 pm
Location: Bethel Park, Pittsbrugh, Pennsylvania USA
Contact:

Post by mcgrath3 » Thu May 04, 2006 9:19 pm

Tim,

Yes you can group a set of radio buttons and then set the background behavior to true and now they will act like the HC family. Each group can be set this way.


This type of background group object is only slightly 'like' the backgrounds that you rand I were used to in HC. THey are in fact a lot better and can be shared on any card via the Object Menu - Place Group items and can also be removed from a card via the same Object Menu - Remove group.

Be aware that new cards created after the background behavior was set will have the group on them which you may or may not want. If not just remoe group.

HTH

Tom
Tom McGrath III
Lazy River Software
3mcgrath@comcast.net

Timothy
Posts: 78
Joined: Tue Apr 11, 2006 7:38 pm

Post by Timothy » Thu May 04, 2006 10:04 pm

Hey Tom!

I got brave and ambitious and tried it on a test stack. Backgrounds (or groups) layered upon backgrounds, layered upon backgrounds, seem to present no particular problem to RR. That is handy. It's HyperCard alien, that's for sure. It violates the "stack of cards" paradigm. This isn't your father's hyperCard :)

As a HC retread, I have a tendency to think of one group as "underneath" another one, but that probably isn't quite right, except for the sake of the graphical display. As far as I can tell, a button in a group lying "underneath" another group of buttons receives its mouseClicks normally. It isn't quite like one stack lying "underneath" another stack.

I guess this is why button families have been abandoned. Buttons can be literally grouped any which way, and will behave as if they are in families, and will still get copied to new cards, if "behave as a background" is turned on, just as if there were only one HC-like background.

Thanks again,

Tim

Post Reply

Return to “Talking LiveCode”