set the visible property of a group in script

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
joaoserras
Posts: 1
Joined: Sun Oct 09, 2022 11:27 am

set the visible property of a group in script

Post by joaoserras » Mon Oct 24, 2022 9:31 am

Hi.
On my interface I need to set the visible property of a group after clicking a button.

My code is:

Code: Select all

on mouseUp pButtonNumber
   
   -- set the visible of grp "grp_control_panel" to true
   go to card "base_form"
   
end mouseUp
but it does nothing... the group stays invisible... can anyone help?

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9445
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: set the visible property of a group in script

Post by richmond62 » Mon Oct 24, 2022 9:56 am

If you remove the '--' at the front everything should work.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9731
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: set the visible property of a group in script

Post by dunbarx » Mon Oct 24, 2022 2:01 pm

Hi,

Richmond zeroed in on what seems to be the problem.

But I assume that in your post, the "--" comment tag was not really in your handler. After all, you did write that very line, which on its own would have done exactly what you asked for here.

In other words, is something else going on?

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9731
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: set the visible property of a group in script

Post by dunbarx » Mon Oct 24, 2022 2:03 pm

Maybe you did not know that "--" denotes a comment, and anything following will be ignored?

Craig

RCozens
Posts: 138
Joined: Thu Aug 05, 2021 6:42 am
Location: Manchester, CA USA

Re: set the visible property of a group in script

Post by RCozens » Mon Oct 24, 2022 5:27 pm

Hi,

I'm assuming you originally tried your script without the "--".

Have you previously set the visibility of individual controls in the group? Any control whose visibility property is set to false will not become visible when the group visibility is set to true.

See the attached stack. It has a group of three images that can be shown or hidden by the click of a button; but there are also buttons to show & hide one of the images. If that image is hidden, it will not be visible when the group visibility is set to true.

The converse is not true: setting a grouped control's visibility to true will not make it visible if the group's visibility is false.

Cheers!
Attachments
Group Visibility.zip
(1.83 KiB) Downloaded 55 times
Rob Cozens dba Serendipity Software Company
Manchester, CA USA

Each new generation gives more attention to the man-made world...
and less attention to the world that made man.

Post Reply

Return to “Talking LiveCode”