dunbarx wrote:I am not sure this is unexpected behavior.
Setting aside the fact that you have two fields with the same names, always risky, what happens if you "hide fld "p" of grp "child"? This explicit reference works as advertised, regardless of layer number, and is the least you could do for the engine with those identically named fields.
Craig Newman
hi, Craig.
yes, i could agree with you if i was using a generic
but in the case above described i'm referring specifically to the fld owned by a specific grp. what i mean is: any control should have a property like pParent returning the real parent grp. or this is what i think, otherways the property "owner" is not exactly what one expect to be(*).
in my opinion, this piece of code
Code: Select all
answer the id of the owner of me & cr & the id of the owner of fld "p" of the owner of me
is enough clear about the unreliability of that property. try it. it seems LC mixes two "owners".
there are many ways to resolve this "issue" (in quotes, to not hurt anyone :->). that's not the point.
about me, now i know that, in the future, while making a grp dinamically i'll remember to set for each control a custom property as decribed above (btw, this what i was hoping someone would have been replied: "you silly, use the XXX property, instead!").
in my case, currently i'm developping an app where there are parents grps owning child(s) owning child(s) owning child(s) and so on. each child is a clone of a model, added by user (it's a "decision making" app). each grp has fields with numbers to be calculated. the process is reiterative. since yesterday (after a small change during debug which moved a fld after a child grp) i know it's better to not run the following:
in child grps:
Code: Select all
on doCheckMe
return (fld "p" of me)*(fld "v" of me)
end doCheckMe
on btn "calculate" in child grp
Code: Select all
on doCheckMyGrp
return (fld "p" of the owner of me)*(fld "v" of the owner of me)
end doCheckMyGrp
on fld "v"
Code: Select all
on keyUp
return (fld "p" of the owner of me)*(me)
end keyUp
cause of this "expected behavior". note: of course all of the above works rightly IF the object is BEFORE another child inside the grp.
just curiosity: why, in your opinion, that should be an "expected behavior"?
the dictionary says:
"Use the owner property to find out which object another object belongs to in the object hierarchy."
the glossary also says:
"owner: The object that contains another object;[…]a grouped control is owned by its group"
and
"synonym: parent" (which actually does not work)
(*)so probably that's not a bug but a feature request, instead…? or half a bug…
regards.