Page 1 of 1

Do fields get assigned different numbers when compiled?

Posted: Mon Aug 24, 2009 4:29 pm
by Paul D
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?

Posted: Tue Aug 25, 2009 4:15 am
by Janschenkel
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.

Posted: Tue Aug 25, 2009 3:03 pm
by whelkybaby
Don't any libraries that are added when you build your standalone persist as invisible groups on your card? If they are inserted in this fashion, this might account as to why the numbering of your fields changes so dramatically.

Best to stick with Jan's advice here.

Steve

Posted: Tue Aug 25, 2009 3:32 pm
by FourthWorld
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.

Posted: Tue Aug 25, 2009 4:26 pm
by Paul D
FourthWorld wrote:When it returns "field 73" were you asking for the name or the short name?
i was asking for the clickfield. in developer mode it was 73, in the exe it was 271. everytime.

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.

Posted: Tue Aug 25, 2009 5:37 pm
by FourthWorld
Do you have a DataGrid on that card?

Posted: Wed Aug 26, 2009 5:27 pm
by Paul D
yeah 4 of them.

Posted: Wed Aug 26, 2009 9:10 pm
by FourthWorld
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.