clickLine and field #

Jeanne A. E. DeVoto revolution at jaedworks.com
Fri Dec 9 20:16:51 EST 2005


At 6:11 PM -0400 12/9/2005, Steven Fernandez wrote:
>I notice that the function clickLine return the line clicked on along
>with the field number. What is the "fieldNumber"? I just spent a long
>time debugging a script because I could not understand what "field 3"
>was when I have no field called by that name. If I look at the stack
>inspector is there some way of figuring out which field is #3. I was
>expecting "line 3 of field myFieldName" Learning Transcript is a
>challenge. I know there is going to come a moment when I'll feel like
>I got it. That moment is not here yet.

All objects can be identified by name, ID, or number - they're three 
ways of specifying the same object.

Name you know about already:
    get the text of field "My Field" -- uses the name
You find (and change) the name in the "Basic Properties" pane of the 
property inspector.

ID is assigned by the engine when the object is created, and (except 
for the ID of a stack) never changes:
   get the text of field ID 923 -- does the same thing using the ID
The ID appears in the title bar of the property inspector.

Number is related to the back-to-front layer order of objects on a card:
   get the text of field 3 -- does the same thing again using the number
The number is in the "Size and Position" pane of the property inspector.

If you use "Send to Back", "Move Backward", "Move Forward", or "Bring 
to Front" in the Object menu, the object's number may change because 
its front-to-back ordering is changing. (For cards, the number of the 
card is the order in the stack. When you open a stack, you see card 
number 1. If you "go next card", you go to card number 2, and so on.)

All of these ways of referring to an object have advantages and 
disadvantages, so you may find yourself using different ones 
depending on the circumstances. Using the name makes code easy to 
read ('put x into field "Total Amount"); on the other hand, you can 
change the name, and there can be more than one object with the same 
name, which can cause hard-to-debug problems. The ID is 
incomprehensible but stable and unique. The number is changeable, but 
is good to use if you're looping through all the fields on a card.

You can find more by checking out the name, ID, and number properties 
in the docs.
-- 
jeanne a. e. devoto ~ revolution at jaedworks.com
http://www.jaedworks.com



More information about the use-livecode mailing list