Do fields get assigned different numbers when compiled?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Do fields get assigned different numbers when compiled?
Im trying to use the clickfield function but I am running into trouble. When I am in developer mode one of my fields return "field 73" for clickfield. So in my code I use "field 73" to determine if that field is being clicked. But when I compile to an exe that same field gets its number changed to "field 271". So the code is looking for 73 and not finding it as it is now returning 271. Why would the field get assigned a different number?
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
It's best to work with the field name or its id to take decisions. The field layer may vary when other controls are added to or removed from the card.
Jan Schenkel.
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
-
- Posts: 47
- Joined: Sat Nov 17, 2007 6:04 pm
-
- VIP Livecode Opensource Backer
- Posts: 10043
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
When it returns "field 73" were you asking for the name or the short name?
Remember that the Rev IDE automatically assigns names to fields with "field N" where N is the number of the field at the time it was created. This can confuse some scripts (and scripters <g>), esp. if the order of objects is changed.
Remember that the Rev IDE automatically assigns names to fields with "field N" where N is the number of the field at the time it was created. This can confuse some scripts (and scripters <g>), esp. if the order of objects is changed.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
i was asking for the clickfield. in developer mode it was 73, in the exe it was 271. everytime.FourthWorld wrote:When it returns "field 73" were you asking for the name or the short name?
the field number only changed for me after the compile. no biggie, i just changed the code to use the short name of the target instead. i was just curious as to why field numbers got changed after compiling. it makes clickfield a less than popular choice.
-
- VIP Livecode Opensource Backer
- Posts: 10043
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Do you have a DataGrid on that card?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 10043
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
DataGrids are comprised of any number of objects, so if the ordinal number of any DG is greater than the field clicked on, using the clickField will return the correct number but may or may not be what you expect.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn