setting the default folder to the folder where the stack is..

John johng at
Sun Dec 16 17:50:01 EST 2001

     Hope someone can help.  I have an application that needs to look the 
text the user is typing and editing in real time.  For each keystroke I 
need to work out what the current word is.  This is complicated a bit by 
the fact that the user is free to edit text anywhere in the field - 
simply capturing keystrokes and building the word as they type will not 
work because they could have begun editing a word in previously typed 
text.  The following example solves the problem but is very, very slow 
(to the point of making it unusable).

on keyDown
   global keyDownPoint
   put the selectedLoc into keyDownPoint   --get the location of the 
insertion point
   pass keyDown
end keyDown

on keyup
   global keyDownPoint
   put the selectedLoc into lastPoint             --get the location of 
the insertion point
   click at keyDownPoint                          --click at the word 
based on the KeyDown event
   put the clicktext & return after field "debug" --so I can see what has 
   click at lastPoint                             --put the insertion 
point back so I don't type 'backwards'
   pass keyUp
end keyup

    Does anyone know of a way to do this that is reasonably fast?  Any 
thoughts at all would be appreciated.

John Miskimins

More information about the use-livecode mailing list