Relayering a control

Peter Haworth pete at lcsql.com
Fri Feb 7 14:42:12 EST 2014


Thanks Marty and Geoff.

It appears the relayer command was introduced in LC 6.1.  I need to do this
in my lcStackbrowser plugin and I'm reluctant to force people to have at
least 6.1 so I need to find a solution without using relayer.

I think I see the problem now.  The error I get when I have
relayerGroupedControls set to false refers to the source group.  Coupled
with that, Geoff's first example seems to work now - must have messed
something up in my original code.

ANother thing that caught me out is that, although I set the layer of the
control to 7, it actually ends up as layer 6 because of the automatic
relayering that happens by removing the control from the first group.


Pete
lcSQL Software <http://www.lcsql.com>
Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>


On Thu, Feb 6, 2014 at 11:45 PM, Geoff Canyon <gcanyon at gmail.com> wrote:

> 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
> >
> _______________________________________________
> 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