Page 1 of 1
set the layer of a control to the top of a group
Posted: Sat Mar 02, 2013 12:07 pm
by jmburnod
Hi All
i want set the layer of a control to the top of a group
The doc say that is not possible to set the layer of a control of a group to the top of the group
Delete/create this control is the only way i found
Does someone have a trick to avoid this
Best regards
Jean-Marc
Re: set the layer of a control to the top of a group
Posted: Sat Mar 02, 2013 1:55 pm
by Klaus
Hi Jean-Marc.
this IS indeed possible, but at your own risk
...
set the relayerGroupedControls to TRUE
## do your relayer stuff here and now...
...
Best
Klaus
Re: set the layer of a control to the top of a group
Posted: Sat Mar 02, 2013 8:40 pm
by bn
Hi Jean-Marc,
as Klaus said it is a bit risky to fool around with the layer of a grouped control: you can easily "layer it out of the group".
But if you are careful it is ok. Just know what your are doing.
For me this works very well, maybe someone has an easier way.
for testing I made a group from a bunch of overlapping buttons. The buttons don't have any script, especially not a mouseDown handler
put this script into the group
Code: Select all
on mouseDown
set the relayerGroupedControls to true
put empty into tLayers
repeat with i = 1 to the number of controls of me
put the layer of control i of me & comma after tLayers
end repeat
delete last char of tLayers -- a comma
put max (tLayers) into tMaxLayer
set the layer of the target to tMaxLayer
set the relayerGroupedControls to false -- important
end mouseDown
it will bring the button you click to the front.
Kind regards
Bernd
Re: set the layer of a control to the top of a group
Posted: Sun Mar 03, 2013 2:43 pm
by jmburnod
Hi Dears,
Thank one more for help
The Bernd' script work like a charm in a simplified stack i build but not yet in my context. I think i shoot my foot somewhere.
Kind regards
Jean-marc
Re: set the layer of a control to the top of a group
Posted: Sun Mar 03, 2013 6:45 pm
by splash21
If you add an invisible control to the group in the topmost position, (example : a graphic called 'topGraphic'), you can then;
set the relayerGroupedControls to true
set the layer of object "MyObject" to the layer of graphic "topGraphic"
This prevents you accidentally displacing 'MyObject'.
Re: set the layer of a control to the top of a group
Posted: Sun Mar 03, 2013 7:13 pm
by jmburnod
Hi Splash,
Thanks
That is a clever way but only for a group without adding controls
I think the Bernd's way is good.
It is just a dirty solution I have to solve
Best regards
Jean-Marc
Re: set the layer of a control to the top of a group
Posted: Wed Mar 13, 2013 2:54 pm
by david.silmanBUSrUeQ
Hi jmburnod
We've had to do a lot of relayering in the program we're making, if you're just moving a control to the top of a group then here is a simpler way to do it:
Code: Select all
start editing me #or whatever the group is called
set the layer of control <name of control> to top
stop editing
we've found that to be the best way of doing it without any worry of displacing the control out of the group
David
Re: set the layer of a control to the top of a group
Posted: Wed Mar 13, 2013 5:40 pm
by jmburnod
Hi David,
Thanks for this hit
I tested it in my context and it work fine
I noticed delete all controls of the group and rebuild it is a bit faster (25%) than editing background way
What is the better way for the processor ?
Best regards
Jean-Marc