Reorder fields

Geoff Canyon gcanyon at gmail.com
Sat Jul 29 18:20:48 EDT 2023


One trick to this is that objects are included into a group if
relayerGroupedControls is set to true and the layer of the control is set
to the layer above the group. Meaning that if you have this arrangement:

stack "Untitled 1"
card id 1002
|  group id 1005 (1005)
|  |  button "Button" (1006)
|  |  button "Button" (1004)
|  button "Button" (1003)
|  button "test" (1007)

put the layer of button "test"
-- puts 5

set relayergroupedcontrols to false;set the layer of button "test" to 4

This is now the arrangement:

stack "Untitled 1"
card id 1002
|  group id 1005 (1005)
|  |  button "Button" (1006)
|  |  button "Button" (1004)
|  button "test" (1007)
|  button "Button" (1003)

put the layer of button "test"
-- puts 4

Button "test" is immediately above the group, but not in the group

set relayergroupedcontrols to true;set the layer of button "test" to 4

Now the arrangement is:

stack "Untitled 1"
card id 1002
|  group id 1005 (1005)
|  |  button "Button" (1006)
|  |  button "Button" (1004)
|  |  button "test" (1007)
|  button "Button" (1003)

put the layer of button "test"
-- puts 4

The layer of button "test" didn't change, but now it is in the group -- and
the topmost object in the group.

I learned this the hard way through much experimentation building
Navigator. Getting drag-and-drop relayering right with selection of
multiple objects, and discontiguous selections, in and out of groups, is
*painful*, and I've done it several times now...

On Sat, Jul 29, 2023 at 10:46 AM Martin Koob via use-livecode <
use-livecode at lists.runrev.com> wrote:

> Hi MarkwI did not see your later post that the fields were grouped.  My
> scenario was just the most basic case of fields on a card.  I guess it
> would work if all the fields were in 1 group but having fields in different
> groups certainly complicates things. Cool solution though.  I wasn’t aware
> of the relayerGroupedControls option.  Reading the entry in the Dictionary
> I learned some interesting things about groups and layers.
> e.g. you can move an object out of a group by setting its layer above the
> layer of the topmost object in the group or conversely  setting it below
> the bottommost object in the group. Hmmm…. What could you do with that?
>
> True the old brain needs a bit of a work out once in a while to keep the
> neurons running.  Thanks for posting your question.
>
> Martin
>
> > On Jul 29, 2023, at 11:00 AM, Mark Smith <marksmithhfx at gmail.com> wrote:
> >
> > On 29 Jul 2023, at 3:27 pm, Martin Koob via use-livecode <
> use-livecode at lists.runrev.com <mailto:use-livecode at lists.runrev.com>>
> wrote:
> >>
> >> The two ways I have used are either with the property inspector  or by
> script.
> >>
> >> Property Inspector
> >> - click the ‘Position’ tab of the property inspector
> >> - Change the number in the ‘Layer’ field either directly or by using
> the arrow keys.
> >
> > Thanks Martin, but as noted, "items won’t relayer if they are grouped
> and “relayingGroupedControls" is set to false. That was exactly the
> situation I was in. In my case, field A was grouped with label A, etc so
> attempting to relayer them failed. I didn’t notice they were grouped
> because Select Grouped was not chosen in the menu bar. With Select Grouped
> chosen it’s easy to see the label-field grouping, and then to relayer the
> groups (not the fields inside the groups) if need be. Or, you can use the
> PB to do this by just dragging the groups around to relayer them. Finally,
> there’s a property called relayerGroupedControls which will allow you to
> relayer objects inside a group. If that had of been “true” instead of the
> default “false” I would have been able to relayer them in the first
> instance. But you have to be careful with this option as it can also revise
> the grouping. BTW, I just tried it (grouped the labels and fields, set the
> relayerGroupedControls option to true, turned off Select Grouped) and I was
> able to select the individual fields and relayer them using the Layer field
> in the Property Inspector. Kinda cool but my goodness you really have to
> know your stuff to make that manoeuvre happen.
> >
> > But also thank you for the opportunity to discuss this further. It helps
> with the encoding of this new information into my ageing brain 😊 And also,
> if I got any of it wrong, please correct me.
> >
> > Mark
> >
>
> _______________________________________________
> 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