Page 1 of 1

Feld 1 of long ID

Posted: Thu Jul 13, 2017 9:25 am
by trevix
There is something that I don't understand and I hope someone can help:

Put a field inside a group and get the long ID of the group (tLongID).
This script then runs fine:

Code: Select all

put there is a field 1 of tLongID  --returns true, correct
Now, try this:

Put a field in a card (not inside a group) and get the long ID of the field (tLongID)
This script returns true but in my opinion it should not, for consistency

Code: Select all

put there is a field 1 of tLongID  --returns true,??
In this last case field 1 is not a children of tLongID, and should return false.
Am I wrong? And why?
Thanks
Trevix

Re: Feld 1 of long ID

Posted: Thu Jul 13, 2017 10:14 am
by jmburnod
Hi,
Interesting
I believe LiveCode works for us and avoïd some issues. 8)
The owner of fld 1 is the card and in this case LiveCode search the better way to solve it.

I have en other exemple:
set the width of btn 1 to 60.5
force 60.5 to 61
Best regards
Jean-Marc

Re: Feld 1 of long ID

Posted: Thu Jul 13, 2017 2:18 pm
by dunbarx
Hi.

You are saying that the phrase:
there is a fld "yourField" of field id yourFieldID of card id cardID of stack "yourStack"
should return false?

The construction itself is odd, to be sure, in that a control is testing for the existence of itself "of" itself. But I see this as flexibility within the LC parser, not, particularly, a peculiarity, or worse, a fault or inconsistency of that parser. In any case, is this any more that academic? Is there something you require where this gets in the way?

Craig Newman

Re: Feld 1 of long ID

Posted: Thu Jul 13, 2017 3:05 pm
by trevix
It was just my love for consistency and the wrong belief that a control is either inside a group or it's outside.

I came up to this because I had a group (tBigGroup ) containing an unknown number of controls: either fields or groups with a field inside.
In a recursive loop, supplying the ID of each control, I needed to get the text of each field (either if it was by itself or inside a group).

I already solved the problem looking for the word "group" in the long ID of each control. And there are more then enough other way do do it.

Still, it was strange to find out that I could get the content of each field using the same script:

Code: Select all

repeat for each line tID in the childControlIDs of  tBigGroup
put field 1 of control tID --no matter if inside a group or by itself
end repeat
also, there is no difference between these, as long that there is only one Field in the group:

Code: Select all

put field 1 of tLongID_of_a_Group_with_a_field_inside  --result: "Something"
put field 2 of tLongID_of_a_Group_with_a_field_inside  --result: "Something"
put field n... of tLongID_of_a_Group_with_a_field_inside  --result: "Something"

Re: Feld 1 of long ID

Posted: Thu Jul 13, 2017 6:05 pm
by dunbarx
You can loop through all the controls and check the owner. Maybe it might be necessary to check the owner of the owner?

Craig