clicktext and decimal numbers

Robert Brenstein rjb at rz.uni-potsdam.de
Thu Jan 6 08:43:44 EST 2005


>Hi Scott,
>
>>Recently, Klaus Major wrote:
>>>Short question:
>>>When clicking on decimal numbers like 12.34, "the clicktext"*** returns
>>>"12", "." or "34", which is not very helpful if you need the complete
>>>number...
>>>*** "clickcharchunk" and "clickchunk" etc... are working the same way
>>>:-(
>>>...
>>>SHORT scripts preferred ;-)
>
>Ahem... ;-)
>
>>Maybe this could work:
>>
>>function getTheText tField
>>   put fld tField into F
>>   put the clickChunk into T
>>   put value(T) into N
>>   if N is a number or N = "." then
>>     put (word 4 of T) + 1 into C
>>     repeat while (char C of F is a number or char C of F = ".")
>>       put char C of F after N
>>       add 1 to C
>>     end repeat
>>     put (word 2 of T) - 1 into C
>>     repeat while (char C of F is a number or char C of F = ".")
>>       put char C of F before N
>>       add -1 to C
>>     end repeat
>>     return N
>>   else return the clickText
>>end getTheText
>>
>>
>>Regards,
>>
>>Scott Rossi
>>Creative Director
>>Tactile Media, Development & Design
>
>Yes, great, thanks, exactly what i was looking for!
>...and was just too lazy to write it on my own :-D
>
>
>Best from germany
>
>Klaus Major
>klaus at major-k.de
>http://www.major-k.de
>

Would something along the lines of the following work?

get word (the number of words of (char 1 to (word 2 of the 
clickCharChunk) of fld "xxx"))) of fld "xxx"

you may need to check first whether clickChar is a number or at least 
not a space or another word delimiter

Robert


More information about the Use-livecode mailing list