attaching my group id to a control in a subgroup

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

attaching my group id to a control in a subgroup

J. Landman Gay via use-livecode
I have a uniqDna value for each datum in my data.  This is used to store
and retrieve it from a database.

When I create an output group for one of these (and there are a great many
different output groups), the group is labeled with these IDs.

The output group will typically contain label fields and graphics, but gets
its unDna set to the corresponding uniqDna.  It also contains fields for
output.

When an output field is modified, the handler calls the seal routine,
passing the field name, new value, and the unDna.

I had made, for performance reasons, the strong assumption that the output
fields would always be a top level member of the output group.  I also
designed output groups which, for organizational reasons, group the output
fields . . . oops . . .

The closeField handler follows the rule, and assumes that the unDna of the
owner of the target is the uniqDna value it needs.  This backfires when not
true :(

One obvious solution would be to simply ungroup the offending groups--but
there are good reasons to want it have subgroups (such as sharing subgroups
for maintenance of similar outputs with shared elements).

At the moment, the three possibilities I see are,
1) recurse upwards until a group with a unDna is found (well, close; there
are universal fields with no unDna)
2) check the owner of the owner of the target
3) redundantly set the uDna of every output field at group creation/copying
time.

I need this to be blindingly fast, too (although I doubt that this is a
problem in 2017).

Am I missing an obvious way to do this?
--
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: attaching my group id to a control in a subgroup

J. Landman Gay via use-livecode
Can you have a function in the appropriate group that returns its unDna? This way, it will not matter about any subgrouping.

Function MyUnDna
Return the unDna of me
End MyUnDna

Sent from my iPhone

> On Aug 22, 2017, at 6:08 PM, Dr. Hawkins via use-livecode <[hidden email]> wrote:
>
> I have a uniqDna value for each datum in my data.  This is used to store
> and retrieve it from a database.
>
> When I create an output group for one of these (and there are a great many
> different output groups), the group is labeled with these IDs.
>
> The output group will typically contain label fields and graphics, but gets
> its unDna set to the corresponding uniqDna.  It also contains fields for
> output.
>
> When an output field is modified, the handler calls the seal routine,
> passing the field name, new value, and the unDna.
>
> I had made, for performance reasons, the strong assumption that the output
> fields would always be a top level member of the output group.  I also
> designed output groups which, for organizational reasons, group the output
> fields . . . oops . . .
>
> The closeField handler follows the rule, and assumes that the unDna of the
> owner of the target is the uniqDna value it needs.  This backfires when not
> true :(
>
> One obvious solution would be to simply ungroup the offending groups--but
> there are good reasons to want it have subgroups (such as sharing subgroups
> for maintenance of similar outputs with shared elements).
>
> At the moment, the three possibilities I see are,
> 1) recurse upwards until a group with a unDna is found (well, close; there
> are universal fields with no unDna)
> 2) check the owner of the owner of the target
> 3) redundantly set the uDna of every output field at group creation/copying
> time.
>
> I need this to be blindingly fast, too (although I doubt that this is a
> problem in 2017).
>
> Am I missing an obvious way to do this?
> --
> Dr. Richard E. Hawkins, Esq.
> (702) 508-8462
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: attaching my group id to a control in a subgroup

J. Landman Gay via use-livecode
On Tue, Aug 22, 2017 at 3:28 PM, Jonathan Lynch via use-livecode <
[hidden email]> wrote:

> Can you have a function in the appropriate group that returns its unDna?
> This way, it will not matter about any subgrouping.
>
> Function MyUnDna
> Return the unDna of me
> End MyUnDna
>
> It would need to be a group-level function, which isn't a problem.  I'm
always hesitant, though, to rely on "me"  [and finding "me" in the
dictionary is an adventure in itself . . .  {now *Bug 20289*
<http://quality.livecode.com/show_bug.cgi?id=20289> - "me" is nearly
impossible to find in dictionary }]

if I have the structure

  rawRow
    someGroup
        anotherGroup
           myControl

and define in rawRow (actually, in it's behavior)

on getProp uDna

return the uDna of me

end getProp



will this do what I mean?

Seems nice, clean, elegant and fast . . . and doesn't involve a bunch of
redundant setting . . .
--
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: attaching my group id to a control in a subgroup

J. Landman Gay via use-livecode
>
> > It would need to be a group-level function, which isn't a problem.  I'm
> always hesitant, though, to rely on "me"  [and finding "me" in the
> dictionary is an adventure in itself . . .  {now *Bug 20289*
> <http://quality.livecode.com/show_bug.cgi?id=20289> - "me" is nearly
> impossible to find in dictionary }]
>

Search for "me\b" and it will magically appear at the top.  " \bme\b" and
it will be the only entry (leading space will be needed for DP9 due to the
fix to allow searching for '\' without typing '\\').  Reason is that field
in the dictionary is actually parsed as a regex (mostly... the code does
add some things around each term) .
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode