Retrieve the Layer Number of an Object?

Sarah Reichelt sarah.reichelt at gmail.com
Wed Oct 21 16:52:03 EDT 2009


> I want to programmatically get the layer
> number of a button, store the layer number for it,
> move the button to the front, modify the button,
> and then move it back to the layer where it was
> with the set the layer of button "blah" to the VarLayerNumber.
>
> Has anyone done this?  I checked the documentation,
> but couldn't find how to do this seemingly simple thing.
> What am I missing here?

What you are suggesting will work fine unless the button is in a group.
You cannot relayer objects in a group without setting
relayerGroupedControls to true.
However once that is set, it is possible to relayer the object right
out of it's containing group, so be warned.

So assuming that the object's are not in groups, you can do something like this:

put the layer of btn "My Button" into tLayer
set the layer of btn "My Button" to the number of controls on this card

-- do stuff to the button

set the layer of btn "MyButton" to tLayer


Cheers,
Sarah



More information about the use-livecode mailing list