Relayering a control

Geoff Canyon gcanyon at gmail.com
Fri Feb 7 02:45:19 EST 2014


If your setup looks like this:

group id 1007 [1007]
|  button "Button" [1004]
|  button "Button" [1009]
group id 1011 [1011]
|  button "Button" [1010]
|  button "Button" [1012]

Then this:

on mouseUp
   set relayergroupedcontrols to true
   set the layer of btn 2 to 7
end mouseUp

will give the desired result:

group id 1007 [1007]
|  button "Button" [1004]
group id 1011 [1011]
|  button "Button" [1010]
|  button "Button" [1012]
button "Button" [1009]

But if your setup is this:

group id 1007 [1007]
|  button "Button" [1004]
|  button "Button" [1009]
group id 1011 [1011]
|  button "Button" [1010]
|  button "Button" [1012]
button "Button" [1016]

it will result in this:

group id 1007 [1007]
|  button "Button" [1004]
group id 1011 [1011]
|  button "Button" [1010]
|  button "Button" [1012]
button "Button" [1016]
button "Button" [1009]

while this:

on mouseUp
   set relayergroupedcontrols to true
   set the layer of btn 2 to 6
end mouseUp

will result in this:

group id 1007 [1007]
|  button "Button" [1004]
group id 1011 [1011]
|  button "Button" [1010]
|  button "Button" [1012]
|  button "Button" [1009]
button "Button" [1016]

I think this will give the desired result in all circumstances:

on mouseUp

   set relayergroupedcontrols to true

   relayer btn 2 after grp 2

end mouseUp



On Thu, Feb 6, 2014 at 11:04 PM, Peter Haworth <pete at lcsql.com> wrote:

> Let's say I have a card with the following control structure
>
> GroupA (layer 1)
>   ControlA1 (layer 2)
>   ControlA2 (layer 3)
> GroupB (layer 4)
>   ControlB1 (layer 5)
>   ControlB2 (layer 6)
>
> I need to change the layer of control A2 by script to 7 and it should not
> be a member of GroupB.
>
> If I set relayerGroupedControls to true before changing ControlA2's layer,
> it becomes a member of GroupB.
>
> If I set the relayerGroupedControls to false, I get a runtime error that
> the control or group is not open (the card is open).
>
> What am I doing wrong?
>
> Pete
> lcSQL Software <http://www.lcsql.com>
> Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
> SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list