Radio buttons to show/hide group
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Radio buttons to show/hide group
Hermann.
I used "Compile-it" in HC for years. Some of the legacy stacks I still run have its XCMD's and XFCN's still resident there. It takes a little practice to shape handlers in order to use it to best advantage, but the speed increase was astounding. It came, of course, on floppy discs. Of course, on a Mac Plus, you still get a floppy drive.
Craig
I used "Compile-it" in HC for years. Some of the legacy stacks I still run have its XCMD's and XFCN's still resident there. It takes a little practice to shape handlers in order to use it to best advantage, but the speed increase was astounding. It came, of course, on floppy discs. Of course, on a Mac Plus, you still get a floppy drive.
Craig
Re: Radio buttons to show/hide group
LOL. Yes, it's true.[-hh] wrote: Positive Example (wonderful 'shortcut'):
get target = do ("get" && the target) = get the text of the target
True?

Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Radio buttons to show/hide group
Hey Guys,
I needed to use the second example because I have many groups I don't want hidden so I relabeled my groups to headData1, headData2 etc. and tried this:
on mouseup
-- repeat with x = 2 to the number of grps of this cd -- start with grp 2 since grp 1 is the radiobuttons
-- hide grp x
-- end repeat
-- put label of target into tNr; show grp (tNr +1)
repeat with y = 1 to the number of groups of this card
hide group "headData" & y
end repeat
end mouseup
I get this error when I hit Apply:
group "screwsRadioButton": compilation error at line 8 (repeat: garbage where a command should be) near "&", char 16
I can't see what's wrong.
I put headData1 etc. into the label, should it go into name instead? I kinda wanted to keep the names more descriptive for readability in the app browser.
Also in the last commented line above there is (tNr +1). Can someone tell me what the +1 is for ?
I needed to use the second example because I have many groups I don't want hidden so I relabeled my groups to headData1, headData2 etc. and tried this:
on mouseup
-- repeat with x = 2 to the number of grps of this cd -- start with grp 2 since grp 1 is the radiobuttons
-- hide grp x
-- end repeat
-- put label of target into tNr; show grp (tNr +1)
repeat with y = 1 to the number of groups of this card
hide group "headData" & y
end repeat
end mouseup
I get this error when I hit Apply:
group "screwsRadioButton": compilation error at line 8 (repeat: garbage where a command should be) near "&", char 16
I can't see what's wrong.
I put headData1 etc. into the label, should it go into name instead? I kinda wanted to keep the names more descriptive for readability in the app browser.
Also in the last commented line above there is (tNr +1). Can someone tell me what the +1 is for ?
Re: Radio buttons to show/hide group
Bingo.
The basic referential syntax assumes the name, not the label of the control:
may be considered to be (pseudo):
To use the label property (or any other property), you would have to expand the loop explicitly as follows;
Craig
The basic referential syntax assumes the name, not the label of the control:
Code: Select all
hide group "headData" & y
Code: Select all
hide that group who's name is "headData" & y
Code: Select all
repeat with y = 1 to the number of groups of this card
if the label of grp y = ("headData" & y) then hide grp y --always good to use parentheses, though not formally required to compile
end repeat
Re: Radio buttons to show/hide group
Another reason to always use "the" with properties just appeared in another thread. Custom properties require its use. The habit of omitting it can carry over to custom properties and in this case the user could not understand why his code was failing.
I'm being pedantic, but maybe with good reason.
I'm being pedantic, but maybe with good reason.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Radio buttons to show/hide group
Code: Select all
on mouseUp
set pedantic of me to "with good Reason"
answer the pedantic of me
end mouseUp

shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 858
- Joined: Wed Jun 24, 2009 1:17 pm
- Contact:
Re: Radio buttons to show/hide group
shouldn't that be "set THE pedantic of me..."? 
Edit: hmmm maybe Hermann left off the 'the' on purpose and I fell straight into his look-I'm-not-using-a-the-in-this-pseudo-code trap

Edit: hmmm maybe Hermann left off the 'the' on purpose and I fell straight into his look-I'm-not-using-a-the-in-this-pseudo-code trap

"...this is not the code you are looking for..."
Re: Radio buttons to show/hide group
Dave, you were too fast, so I couldn't improve my english wording.
It works: Even Queens are not always right. I learned from dictionary: "the" is optional with (all kind of) properties ...
This optional usage of "the" is the reason, I believe, that it is impossible for the current engine to use an evaluation as a property name. For example set (word 1 of "") of me to "No I'm not." doesn't work. But this works:
[To avoid misunderstandings. The pudding is presumably me.]
Code: Select all
on mouseUp
set beingPedantic of me to "with good Reason"
answer the beingPedantic of me
end mouseUp
This optional usage of "the" is the reason, I believe, that it is impossible for the current engine to use an evaluation as a property name. For example set (word 1 of "") of me to "No I'm not." doesn't work. But this works:
Code: Select all
on mouseUp
set empty of me to "No I'm not."
answer the empty of me
end mouseUp
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 858
- Joined: Wed Jun 24, 2009 1:17 pm
- Contact:
Re: Radio buttons to show/hide group
Let's see if I can improve on what you've done... ah yes how about this:
And the hilarious thing is it actually does compile and work 
Code: Select all
on mouseUp;set beingPedantic of me to "with good Reason";answer the beingPedantic of me;end mouseUp

"...this is not the code you are looking for..."
Re: Radio buttons to show/hide group
Interesting:
http://forums.livecode.com/viewtopic.ph ... 11#p111808
Next time maybe I shouldn't answer from my Android tablet so I can double-check what I read.
http://forums.livecode.com/viewtopic.ph ... 11#p111808
Next time maybe I shouldn't answer from my Android tablet so I can double-check what I read.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Radio buttons to show/hide group
Dave, you won the competition for the best (not the shortest!) one-liner of the day:-)
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 858
- Joined: Wed Jun 24, 2009 1:17 pm
- Contact:
Re: Radio buttons to show/hide group
Hermann - well I should think possibly the most annoying (it is remarkable what the engine will let you get away with) but once Craig realises how many semicolons I've used I may live to regret it

[-hh] wrote:Dave, you won the competition for the best (not the shortest!) one-liner of the day:-)
"...this is not the code you are looking for..."
Re: Radio buttons to show/hide group
I'm away from the computer and LiveCode for a few weeks but if I remember right tNr when chosing the 1st radio button would be 1 (2nd radio button 2, etc) and so you want to show group 2 because group 1 is the group of the radio buttons. So you want to show group nr 1+1 =2.Kevtor wrote:Also in the last commented line above there is (tNr +1). Can someone tell me what the +1 is for ?
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit