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

Geoff Canyon gcanyon at inspiredlogic.com
Sun Dec 16 21:27:01 EST 2001


At 2:48 PM -0800 12/16/01, John wrote:
>    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 happened
>  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.

Have you tried something that doesn't involve clicking twice whenever the user presses a key? I'd probably try something that simply took the selection and worked out looking for spaces (or whatever delimiters work for you).

regards,

Geoff



More information about the Use-livecode mailing list