Objects names

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
francof
Posts: 237
Joined: Fri Apr 11, 2014 10:51 am

Objects names

Post 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
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Objects names

Post by Klaus »

No, but may depend on your scripting :D
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10502
Joined: Wed May 06, 2009 2:28 pm

Re: Objects names

Post 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
francof
Posts: 237
Joined: Fri Apr 11, 2014 10:51 am

Re: Objects names

Post 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
sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm

Re: Objects names

Post 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.
francof
Posts: 237
Joined: Fri Apr 11, 2014 10:51 am

Re: Objects names

Post 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
Post Reply