Using pasteKey in a Search Field Handler

Gregory Lypny gregory.lypny at videotron.ca
Fri Jan 30 23:49:46 EST 2009


Hello everyone,

Yes, I did misspell pasteKey.  Good to have a second set of eyes.   
Thank you, Bob Sneider.

I finally got it working.  The following handlers placed inside a  
search field (the pasteKey handler is at the end) work like a charm if  
you suspend development tools as suggested by Bernd Niggemann.   
However, I found that toggling the development tools on and off while  
testing the script eventually resulted in the pasteKey message not  
being trapped.  Quitting and restarting Rev fixed that.

It may seem odd that a paste command appears in the pasteKey handler.   
It is needed in this case, I think, only because the keyDown message  
that is sent right after is received by the field before any  
characters are placed in it.

As always, thanks for having a look and helping me sort this out.

Regards,

Gregory

------------------------
on keyDown pKey
    if pKey is not "Delete Key" and pKey is not "Paste Key"
    then
       put me & pKey into searchString
    else
       put me into searchString
    end if
    -- [Insert whatever search script you like here.]
    pass keyDown
end keyDown
------------------------
on rawKeyUp pKeyCode
    if pKeyCode = 65288 then send "keyDown" && "Delete Key" to me
    else  pass rawKeyUp
end rawKeyUp
------------------------
on pasteKey
    paste
    send "keyDown" && "Paste Key" to me
end pasteKey
------------------------



More information about the use-livecode mailing list