hiding a label field

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

Post Reply
Scott Richardson
Posts: 34
Joined: Mon May 08, 2006 7:02 pm

hiding a label field

Post by Scott Richardson » Mon Sep 10, 2007 10:59 pm

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

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

Post by Mark » Mon Sep 10, 2007 11:38 pm

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
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

Scott Richardson
Posts: 34
Joined: Mon May 08, 2006 7:02 pm

label field

Post by Scott Richardson » Tue Sep 11, 2007 6:05 pm

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

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

Post by Klaus » Tue Sep 11, 2007 6:37 pm

Hi Scott,

could you please post your script(s) here?
That would help us to help you :-)


Regards

Klaus

Scott Richardson
Posts: 34
Joined: Mon May 08, 2006 7:02 pm

label field

Post by Scott Richardson » Wed Sep 12, 2007 3:26 pm

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

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

Post by Mark » Wed Sep 12, 2007 3:38 pm

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
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

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

Post by Klaus » Wed Sep 12, 2007 5:52 pm

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

Scott Richardson
Posts: 34
Joined: Mon May 08, 2006 7:02 pm

label field

Post by Scott Richardson » Wed Sep 12, 2007 6:18 pm

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?

Scott Richardson
Posts: 34
Joined: Mon May 08, 2006 7:02 pm

label field

Post by Scott Richardson » Wed Sep 12, 2007 6:28 pm

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

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

Post by Klaus » Wed Sep 12, 2007 7:11 pm

:-)

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

Post by Mark » Wed Sep 12, 2007 7:37 pm

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
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

Post Reply