Page 1 of 2

set the layer of group

Posted: Wed Nov 23, 2022 11:01 am
by CAsba
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 ?

Re: set the layer of group

Posted: Wed Nov 23, 2022 11:16 am
by richmond62
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

Re: set the layer of group

Posted: Wed Nov 23, 2022 11:36 am
by richmond62
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.

Re: set the layer of group

Posted: Wed Nov 23, 2022 11:42 am
by Klaus
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
...

Re: set the layer of group

Posted: Wed Nov 23, 2022 11:52 am
by CAsba
Thanks a lot, guys, a lot of good info there - going to be a great help in future.

Re: set the layer of group

Posted: Wed Nov 23, 2022 6:16 pm
by jacque
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

Re: set the layer of group

Posted: Wed Nov 23, 2022 9:35 pm
by dunbarx
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

Re: set the layer of group

Posted: Wed Nov 23, 2022 11:43 pm
by jacque
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.

Re: set the layer of group

Posted: Thu Nov 24, 2022 12:15 am
by FourthWorld
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.

Re: set the layer of group

Posted: Thu Nov 24, 2022 12:31 am
by dunbarx
The date is a function.
Sloppy. :oops:

When pontificating, I must remember also to be correct.

Craig

Re: set the layer of group

Posted: Thu Nov 24, 2022 1:18 am
by jacque
@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.

Re: set the layer of group

Posted: Thu Nov 24, 2022 2:44 am
by FourthWorld
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...

Re: set the layer of group

Posted: Thu Nov 24, 2022 5:21 am
by dunbarx
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

Re: set the layer of group

Posted: Thu Nov 24, 2022 6:13 am
by jacque
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.

Re: set the layer of group

Posted: Thu Nov 24, 2022 7:50 am
by richmond62
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.