Page 1 of 1
hiding a label field
Posted: Mon Sep 10, 2007 10:59 pm
by Scott Richardson
I'm not even sure how to ask this question, but I'll give it a try.
I need to have a series of "checkbox" buttons that when checked or unchecked will "turn on" or "turn off" designated label fields. I would also need a checkbox button to "check all" or "uncheck all" of the checkboxes. The label fields will be on the same card as the checkboxes.
I have tried using some of the basic command scripts to hide the field if the hilite of the checkbox is false, etc., but I can't seem to get anything to work.
I know this may be somethinf simple, but I'm still not very proficient with Rev. I appreciate the help you guys give.
Scott
Posted: Mon Sep 10, 2007 11:38 pm
by Mark
Hi Scott,
Probably, you are looking for something like this:
Code: Select all
set the visible of fld "Your Label Field" to the hilite of me
or
Code: Select all
set the visible of fld "Your Label Field" to the hilite of btn 1
and
Code: Select all
repeat with x = 1 to number of fields of grp "Labels"
set the visible of fld x of grp "Labels" to the hilite of me
end repeat
Best,
Mark
label field
Posted: Tue Sep 11, 2007 6:05 pm
by Scott Richardson
I'm still missing something. I've tried the suggested scripts, which are very similar to the ones I had already tried, but I still get no results. I'm sure it must be something simple that I am not doing. Any thoughts on what I should check first?
Thanks,
Scott
Posted: Tue Sep 11, 2007 6:37 pm
by Klaus
Hi Scott,
could you please post your script(s) here?
That would help us to help you
Regards
Klaus
label field
Posted: Wed Sep 12, 2007 3:26 pm
by Scott Richardson
Klaus,
Thanks — I should have thought to post the scripts before. Just a reminder of what I am trying to do: I need to toggle the visibility of label fields on and off by checking (or unchecking) a checkbox on the same card. Even though I have done a project with Rev in the last year, I have never had to use checkboxes, so bear with me.
1. I placed a checkbox button on the card ("Check" just to keep the names simple for the test).
2. Then I placed a label field on the same card ("Label")
3. I opened the script window for the check box and put,
[ set the visible of fld "Label" to the hilite of me ]
and applied. I also tried,
[ set the visible of fld "Label" to the hilite of "Check" ]
to no avail.
(I also tried going the other way around and scripting the field:
[ if the hilite of button "Check" is true then set the visible of me to true else set the visible of me to false ])
I'm sure I'm just leaving something out, but I have used Rev so little, I just can't see what it is.
Thanks for the assistance.
Scott
Posted: Wed Sep 12, 2007 3:38 pm
by Mark
Scott,
Have you read section 5.1.3 of the user manual? Have you had a look in the user manual at all? Do you know what messages and handlers are? I have a feeling that you need to get yourself familiar with the basics before you try to write a script.
Best,
Mark
Posted: Wed Sep 12, 2007 5:52 pm
by Klaus
Hi Scott,
what Mark probably wanted but did not dare to ask

is:
Did you put a
-> on mouseup
BEFORE and
-> end mouseup
AFTER your code?
The script of the "checkbox" button should read:
Code: Select all
on mouseup
set the visible of fld "Label" to the hilite of me
end mouseup
Best
Klaus
label field
Posted: Wed Sep 12, 2007 6:18 pm
by Scott Richardson
I'm sorry I haven't been more clear. I'm not very good at this forum thing.
Yes. I am aware of handlers, etc. In fact, the only other project I have done used literally thousands (it was a 400+ card stack with 12+ buttons per card). I have just never used a checkbox or radio button before. There must be something about the mechanics of a checkbox I don't know.
I can already accomplish what I need by using two simple buttons, one for "on" and one for "off," but since I will have as many as 20-30 "on-off" sets per card, I thought it would be easier to simply use a checkbox for "on-off."
Perhaps my question should have been (instead of what script), what handlers are appropriate for using the checkbox?
label field
Posted: Wed Sep 12, 2007 6:28 pm
by Scott Richardson
Mark, Klaus, et al
Boy! Now I feel really stupid! My first scripts/handlers worked just fine. I just realized that my little test stack had "Show Invisible Objects" turned on. That is why I could never get the field to "go off" when I unchecked the checkbox. Dumb! Dumb! Dumb! Like I said before, I was sure it was something simple I was overlooking.
Sorry to have wasted your time; I really appreciate the patience!
Scott
Posted: Wed Sep 12, 2007 7:11 pm
by Klaus
Posted: Wed Sep 12, 2007 7:37 pm
by Mark
Hi Scott,
It happens. Another nice one is to turn off messages (in the Development menu) and wonder why your script doesn't run, when you're back with a fresh mug of coffee.
Mark