set the layer of group

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

CAsba
Posts: 364
Joined: Fri Sep 30, 2022 12:11 pm

set the layer of group

Post by CAsba » Wed Nov 23, 2022 11:01 am

Hi
I'm trying set the layer (and so hide) a group (consisting of a rounded rectangle and label field) with

"set the layer of the group"grphelp1" to layernumber 3"

and also

"set the layer of the group"id 2075" to layernumber 3"

and neither work.

Any ideas why ?

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

Re: set the layer of group

Post by richmond62 » Wed Nov 23, 2022 11:16 am

As far as I am aware you CANNOT set the layer of a group.

BUT, if you want to hide a group why not just do this:

Code: Select all

set the vis of group "myGuff" to false
or

Code: Select all

hide group "myGuff"
-
Screen Shot 2022-11-23 at 12.18.33 PM.png
Attachments
Groupies.livecode.zip
Stack.
(104.42 KiB) Downloaded 45 times

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

Re: set the layer of group

Post by richmond62 » Wed Nov 23, 2022 11:36 am

I put my foot in my mouth:
As far as I am aware you CANNOT set the layer of a group.
Actually worked fine over here (MacOS 10.7.5, LC 8.1.10).
-
layerGroup.jpg
-
AND I assume it did NOT work with you because you wrote "layernumber 2" instead of just a simple number.

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: set the layer of group

Post by Klaus » Wed Nov 23, 2022 11:42 am

Of course you can also set the layer of a group!
But your syntax is wrong! -> ...to layernumber 3 :shock:

Why not take a quick look into the dictionary to check and be sure?

Hint:
Something like this: ... {layerNumber | top | bottom} shows the available OPTIONS for a command in the dictionary. 8)
And means you can provide a NUMBER or TOP or BOTTOM
Always check the "real world" examples on that page.

Code: Select all

...
set the layer of btn "booboo" to 42
...
## Float above every other control -> highest layer
set the layer of btn "booboo" to TOP
...
## Put it into the "background" -> lowest layer
set the layer of btn "booboo" to BOTTOM
...

CAsba
Posts: 364
Joined: Fri Sep 30, 2022 12:11 pm

Re: set the layer of group

Post by CAsba » Wed Nov 23, 2022 11:52 am

Thanks a lot, guys, a lot of good info there - going to be a great help in future.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7238
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: set the layer of group

Post by jacque » Wed Nov 23, 2022 6:16 pm

Also, you don't need "the" before a control reference.
set the layer of group "my Group" to 3
Only literal strings need quotes, like the names of controls. So when referring to IDs, no quotes are needed.
set the layer of group id 12345 to 3
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: set the layer of group

Post by dunbarx » Wed Nov 23, 2022 9:35 pm

About that "the" thing.

Just because LC forgives the insertion of the completely spurious "the" in many cases is no reason to abuse it. In fact LC simply ignores it, so it is a waste of time, energy and readability to do so. "The" should only be used to identify properties, in one of the precisely two ways to do so:
Get date()
Get the date
Clean up your acts. 8)

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7238
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: set the layer of group

Post by jacque » Wed Nov 23, 2022 11:43 pm

The date is a function. :)

But yes, use "the" for all properties and some functions if you choose the natural language option instead of the parenthetical version. To make it more confusing, some of the newer functions don't have natural language options, particularly all the mobile functions.

Some people choose parentheses for all functions just to keep things simpler.

There is one notable exception that will get people in trouble if they omit "the" when referring to functions. See "target", where "the target" is a reference to an object, but plain "target" is the text of a field. You can thank the HC team for that one.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9842
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: set the layer of group

Post by FourthWorld » Thu Nov 24, 2022 12:15 am

jacque wrote:
Wed Nov 23, 2022 11:43 pm
There is one notable exception that will get people in trouble if they omit "the" when referring to functions. See "target", where "the target" is a reference to an object, but plain "target" is the text of a field. You can thank the HC team for that one.
That was so freaky I had to try it, and it looks like something LC made more consistent, as this produces two lines with the object reference:

Code: Select all

on openfield
   put "target(): "& target() &cr& "the target: "& the target
end openfield
Did I get that right?

Might be one of those edge cases where Dr Raney looked at HC's syntax and decided to go a slightly different direction.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: set the layer of group

Post by dunbarx » Thu Nov 24, 2022 12:31 am

The date is a function.
Sloppy. :oops:

When pontificating, I must remember also to be correct.

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7238
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: set the layer of group

Post by jacque » Thu Nov 24, 2022 1:18 am

@Richard, not quite. Type some text into a field. In the message box: put target. I think that should work, but not at my Mac right now. I confess to only using this variety of target once since I left HC.

If you use parens or "the" you get the same object related function. The dictionary has both terms, though you may need to click the "target" link in the related terms if you get the usual description.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9842
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: set the layer of group

Post by FourthWorld » Thu Nov 24, 2022 2:44 am

jacque wrote:
Thu Nov 24, 2022 1:18 am
@Richard, not quite. Type some text into a field. In the message box: put target....
If you use parens or "the" you get the same object related function.
"target" works by itself with no parens?

That's so weird I'm going to pretend I never heard it...
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: set the layer of group

Post by dunbarx » Thu Nov 24, 2022 5:21 am

Jacque.

"Target" in that scenario will return the name of the card. What else could it guess might be in the mind of the user?

In order to direct "target" to, er, the target, you have to do something where "the target" would return a value for, er, the target of interest.

Like in a "mouseEnter" handler, or whatever. Bullseye.

I think "target", an oldie but goodie, is lovely.

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7238
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: set the layer of group

Post by jacque » Thu Nov 24, 2022 6:13 am

Look up "target" in the dictionary, there are two entries. One is the function, the other is a keyword. It's the keyword you want. The example in the entry is:
answer target
And the summary::
Specifies the text contents of the field which was the target of the message currently being handled.
Like I said, it came in handy for something but I can't remember now what it was. I did use it though.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: set the layer of group

Post by richmond62 » Thu Nov 24, 2022 7:50 am

Craig, while you may pontificate from time to time, you do not, unlike someone else hereabouts, do it in a condescending manner. 8)

Anyway, even if we get things wrong, they should serve to stimulate further thought.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”