Page 1 of 1
Layer control within groups
Posted: Thu Jul 14, 2011 8:37 am
by SteveTX
How you set layers relative to a group?
I have built a tabbed menu. Each tab is a group, and all tabs are in a single group. On mouseDown, I want to set the tab to the top of the group of tabs. This doesn't seem to work, and position "top" is considered absolute to the stack, instead of relative to the group. Setting specific layer numbers won't work as this stack has hundreds of layers.
(grp tab3 of grp tabs)
Code: Select all
on mouseDown
set the layer of grp me to top
set the colorOverlay["opacity"] of grp "tab2ContentWindow" to 80
set the colorOverlay["opacity"] of grp "tab4ContentWindow" to 80
set the colorOverlay["opacity"] of grp "tab5ContentWindow" to 80
set the colorOverlay["opacity"] of grp "tab3ContentWindow" to 0
set the visible of grp "firewallNetwork" to false
set the visible of grp "connectionNetwork" to false
set the visible of grp "routerNetwork" to true
end mouseDown
Re: Layer control within groups
Posted: Thu Jul 14, 2011 12:13 pm
by Klaus
Hi Steve,
This doesn't seem to work...
So does it work or does it not work?
Every object has a TOP property, so instead of using the absolute TOP (relative to the card)
you could use the TOP of another group as a reference!
...
set the top of grx X to the top of grp Y
...
To "relayer" objects within a group you need to set the "relayergroupedcontrols" to TRUE at first in your script
and set it to FALSE when you are finished.
HANDLE WITH CARE!
Relayering objects within a group can be a dangerous thing!
Check "relayergroupedcontrols" in the dictionary for more info!
Best
Klaus
Re: Layer control within groups
Posted: Thu Jul 14, 2011 4:18 pm
by SteveTX
Code: Select all
set the top of grx X to the top of grp Y
There is no mention of this syntax that I found anywhere. And yes, "relayergroupedcontrols" is dangerous.
However, even upon doing that code, it removes grp X out of grp Y. I want to keep grp X inside grp Y while moving grp X to the front layer.
Re: Layer control within groups
Posted: Fri Jul 15, 2011 5:57 am
by SteveTX
bump. Any ideas how to change layer of group X inside group Y without it being removed from group Y via relayergroupedcontrols?
Re: Layer control within groups
Posted: Fri Jul 15, 2011 11:43 am
by Klaus
Hi Steve,
1. there is an entry about TOP in the dictionary! This is a property that can be "get" and "set" for any object.
2. Setting "the top" of an object will NOT change its layer, only its location!
SteveTX wrote:Any ideas how to change layer of group X inside group Y without it being removed from group Y via relayergroupedcontrols?
"relayergroupedcontrols" is just a setting that will allow you to relayer objects inside of a group when set to TRUE.
Otherwise you will get an error if you try to relayer object with this set to FALSE.
And of course you will need to manage the correct "new" layers of your objects inside of a group, that's why this is so dangerous!
You ned to calculate new layers from the existing layers, e.g. if group A is the "main" group that contain other groups,
you cannot move groups inside of grp A to any lower layer than the one of group A, or these objets will get removed from group A!
Know what I mean?
Make tests with some dummy groups and you will get a feel for this.
Best
Klaus
Re: Layer control within groups
Posted: Sat Jul 16, 2011 2:37 am
by SteveTX
Klaus,
You are correct. Is there a adjective that I can use to refer to relative layers? ex: front/back? The example syntax in the dictionary for "layer" is rather misleading, using "top" and "bottom", when naturally people are going to think this refers to the "front" and "back" regarding layer control. So if I have groups A, B, and C, all inside group Z, how would I say "set the layer of group B to the front of group Z" ?
Re: Layer control within groups
Posted: Sat Jul 16, 2011 9:19 am
by jmburnod
Hi SteveTX ,
The example syntax in the dictionary for "layer" is rather misleading
yes, you're right
Code: Select all
So if I have groups A, B, and C, all inside group Z, how would I say "set the layer of group B to the front of group Z" ?
You can see the layer of each objects in the "browser application".
Like Klaus said, it is a dangerous way and i watch setting the layer of a group is not possible with the object inspector.
It is a good question for Bernd but i think he is again on the beach
Best regards
Jean-Marc
Re: Layer control within groups
Posted: Sat Jul 16, 2011 10:28 am
by Klaus
Hi Steve,
TOP and BOTTOM in regard to layers do always mean the (absolute!) HIGHEST (= number of objects on a card) and LOWEST (= 1) layer.
This cannot be used "relatively" like in your example, so yes, the docs are a bit misleading here.
Best
Klaus