concatenating with the ampersand
Jim Ault
JimAultWins at yahoo.com
Sat Mar 10 16:47:10 EST 2007
On 3/10/07 1:19 PM, "Joe Lewis Wilkins" <pepetoo at Cox.Net> wrote:
> Hi Jim,
> Of course this also goes around the ampersand problem I was
> encountering, though your comment about the literal may have been the
> problem. I diddled with it so much that I'm not sure whether I had
> that problem earlier, or not.
>
> I like your two liner, which had never occurred to me. The numbers
> ARE different, so your last thought won't work.
>
> On Mar 10, 2007, at 1:04 PM, Jim Ault wrote:
>> set the itemdel to "."
>> send mouseup to field (item one of value(the clickline) &"H")
Joe,
The only time you need to worry about references being surrounded by quotes
is if there is ambiguity about the name...
examples >>
fld, btn, group, image, graphic
--avoid using a reserved Rev word as a name
-- btn "image", fld "buttons", grc "btn"
instead use something like
--> btn image01, fld buttonsAll, grc btnA
avoid naming any card or object with just a number, since Rev may think
put "Day light savings this weekend" into fld "4"
--> could be the 4th field, even if it is not named "4"
The advantage of this in what you are doing in your original question with
building the field name from components is that you can avoid the need for
quote&variable"e syntax so your code stays cleaner and more readable.
When I have to build component strings, One trick I use is to use multiple
lines so I can see all the steps in the debugger.
put "rainy day" into var01
get var01
get it & space & quote & the short name of this card & quote & quote
get it & cr & "Time to do more Rev"
put it into msg
-- now stopping in the debugger will let you
-- examine the result of all of this and make corrections
breakpoint
get "fld" & space
get it & quote
get it & var02 & quote
this is easier to inspect all of the amp's until you get used to doing it in
your head. The code runs just as fast as you will need it to go.
Jim Ault
Las Vegas
More information about the use-livecode
mailing list