clicktext and decimal numbers
Lynch, Jonathan
BNZ2 at CDC.GOV
Thu Jan 6 09:30:59 EST 2005
For a spellcheck for a program at work - I had to make it so that it
selected the actual word, even if that word contained a dash. I did it
basically by starting with the character under the mouse click, then
counting to the left until reaching a space or linefeed or the beginning
of the field - then also counting to the right with similar limits.
The code is pretty simple, but you might be able to streamline it - my
programming skills are still in the amateur category:
On mousedown
put word 2 of mousecharchunk() into aaa
if ((character aaa of me <> " ") and (character aaa of me <>
linefeed)) then
put aaa into aaaleft
put aaa into aaaright
put the number of characters in me into PPP
repeat until stopvar = 1
if stopleft <> 1 then
if ((character aaaleft of me = " ") or (character aaaleft of
me = linefeed)) then
put 1 into stopleft
put (aaaleft + 1) into aaaleft
else if (aaaleft = 1) then
put 1 into stopleft
else
put (aaaleft - 1) into aaaleft
end if
end if
if stopright <> 1 then
if ((character aaaright of me = " ") or (character aaaright of
me = linefeed)) then
put 1 into stopright
put (aaaright - 1) into aaaright
else if (aaaright = PPP) then
put 1 into stopright
else
put (aaaright + 1) into aaaright
end if
end if
if (stopleft = 1) and (stopright = 1) then put 1 into stopvar
end repeat
put character aaaleft to aaaright of me into ccc
end if
end mousedown
This script winds up with the word you clicked on being put into the ccc
variable.
I use it to check against a list of words that are frequently used
improperly in medical/scientific writing, to make sure I don't miss a
possible mistake when editing submissions to our publication.
Cheers,
Jonathan
-----Original Message-----
From: use-revolution-bounces at lists.runrev.com
[mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of Klaus
Major
Sent: Thursday, January 06, 2005 5:39 AM
To: How to use Revolution
Subject: clicktext and decimal numbers
Hi friends,
a happy 2005 to all of you!
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
:-(
Now i worked around this by setting the "textstyle" of those numbers to
"link" and
set the underlinelinks to false
set the linkcolor to 0,0,0
set the linkvisitedcolor to 0,0,0
set the linkhilitecolor to 0,0,0
to make the numbers look like any other text.
Now "the clicktext" returns "12.34", which is what i want.
But this way other links do not look like links anymore, since these
properties are
valid either globally or for a specific stack...
Does anybody have another solution for this phenomenon?
SHORT scripts preferred ;-)
Thanks in advance.
Regards
Klaus Major
klaus at major-k.de
http://www.major-k.de
_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list