Feld 1 of long ID

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Feld 1 of long ID

Post by trevix » Thu Jul 13, 2017 9:25 am

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
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Feld 1 of long ID

Post by jmburnod » Thu Jul 13, 2017 10:14 am

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
Last edited by jmburnod on Thu Jul 13, 2017 6:40 pm, edited 1 time in total.
https://alternatic.ch

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9579
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Feld 1 of long ID

Post by dunbarx » Thu Jul 13, 2017 2:18 pm

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

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Feld 1 of long ID

Post by trevix » Thu Jul 13, 2017 3:05 pm

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"
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9579
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Feld 1 of long ID

Post by dunbarx » Thu Jul 13, 2017 6:05 pm

You can loop through all the controls and check the owner. Maybe it might be necessary to check the owner of the owner?

Craig

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”