Page 1 of 1

Objects names

Posted: Thu Jul 24, 2014 4:02 pm
by francof
ciao all,
I have a small doubt. may cause problems to designate with the same name 2 objects (e.g. 2 Text Field), into 2 different cards ?

regards
franco

Re: Objects names

Posted: Thu Jul 24, 2014 4:10 pm
by Klaus
No, but may depend on your scripting :D

Re: Objects names

Posted: Thu Jul 24, 2014 4:55 pm
by dunbarx
Hi.

What Klaus said. However, this is sometimes a very useful thing. For example, you can have a group that contains a single text field, behaves like a background, and will therefore appear on many cards, including any new ones you create. This will have the same name on all cards, and you manage that at the card level:

Code: Select all

put "foo" into fld "yourField' of card 20.
The word would go into the field only on card 20 (Never mind that you can make all the text the same. That is another story)

Problems usually arise, as Klaus mentioned, when you try to reference two similarly named objects on the SAME card;

Code: Select all

Put "foo" into field "yourField"
--with two fields of that name on that card

In this case, LC will place the text into the field with the lowest layer number. This may not be what you wanted.

If you have these fields on different cards, then the problem is usually not so great, since only the field on the current card will be directly accessible.

Craig Newman

Re: Objects names

Posted: Thu Jul 24, 2014 8:29 pm
by francof
thanks all,
dunbarx wrote: ...
Problems usually arise, as Klaus mentioned, when you try to reference two similarly named objects on the SAME card;
...
this is something I, absolutely, want to avoid. I only want to copy some objects from a card to a new one, and adapt their scripts.

ciao
franco

Re: Objects names

Posted: Sat Aug 02, 2014 2:51 pm
by sritcp
dunbarx wrote:Problems usually arise, as Klaus mentioned, when you try to reference two similarly named objects on the SAME card;
Actually, if handled carefully, same names on same card can result in a great deal of efficiency.
My response to a different post by Franco gives an example of this strategy.
http://forums.livecode.com/viewtopic.ph ... 78#p108407

Regards,
Sri.

Re: Objects names

Posted: Sat Aug 02, 2014 4:18 pm
by francof
Hi Sri,
sritcp wrote:
dunbarx wrote:Problems usually arise, as Klaus mentioned, when you try to reference two similarly named objects on the SAME card;
Actually, if handled carefully, same names on same card can result in a great deal of efficiency.
My response to a different post by Franco gives an example of this strategy.
http://forums.livecode.com/viewtopic.ph ... 78#p108407

Regards,
Sri.
I apologize myself not having responded you in that post you mention above. I missed the mail notification :oops:
at the time the terms of the program are slightly different, now I've 1 question at a time and 3 possible answers.... but will be better talk about it in the other topic

Regards, and thanks for your help.
franco