I've looked all over, but I can't seem to find how to reference these objects individually.
Code: Select all
put "hello world" into fld "test" 3
put "hello world" into fld "test"[3]
put "hello world" into fld 3 "test"
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Code: Select all
put "hello world" into fld "test" 3
put "hello world" into fld "test"[3]
put "hello world" into fld 3 "test"
no way!Referencing Objects of the Same Name?
Yes, but doing so is a bad idea!Livecode lets you create as many objects with the same name as you want.
Code: Select all
repeat with x = 1 to the number of fields of this cd --this will affect EVERY field on the card
set the label of field x to "textFld"&x --The lowest layer field is field 1 next up is field 2 etc.
end repeat
well, only mad because of your missing PARENS: %]]$#??itSimon wrote:I'm pretty sure Klaus will be mad with me because there is no way that you should ever have objects with the same name even if you can reference them
Though this is absolutely good practice, it is not necessary.well, only mad because of your missing PARENS: %]]$#??it
...
set the label of field x to ("textFld" & x)
The key question may be why do the controls all have the same name?townsend wrote:...if the IDs are not sequential, and only you have only identical names, is there some way they they can be referenced in a Repeat loop?
The difficulty with HyperCard is that it died too young. Like a child's untimely death, the world is denied the chance to see what might have become of her had she lived a full life.dunbarx wrote:I used to exploit the looseness of Hypertalk. Seemed like a gift. Now it makes me pause.
No, no, your well written insights are always worth reading.FourthWorld wrote:I started to write a reply but got too long (a bad habit of mine)
Yeah, the glorious "Disco" days: http://www.youtube.com/watch?v=YSR0bvCPf2MSimon wrote:Oh the shame...
Shame....
Simon
Well, I did, but it was an edge case and he didn't buy it. It sure would have made my life easier though.FourthWorld wrote:I argued with him, and he was ultimately willing to offer a compromise, in the form of a challenge: if I or anyone else could find a reason why it would be necessary to have custom behavior for a function that must have the name of a built-in function, he'd add support for that.
I took his challenge to the community. None of us could ever come up with one.
I'm using the Charts Engine plugin. Rather than use the automatically generated legend, I've created a series of Option Menu Buttons for each line in the chart, with various functionality.The key question may be why do the controls all have the same name?