Trapping mousedown with control key or right click
Bill
bill at bluewatermaritime.com
Wed Jul 21 13:15:12 EDT 2004
Someone posted:
--on mouseDown
-- if (the controlKey is down) then
-- beep
-- put the long name of the target
-- --set the clipboardData["text"] to the long name of me
-- end if
-- pass mouseDown
--end mouseDown
And it gave me an idea on how to give nine-to-five reports like search
capability for each field in my mySQL database front end but for some reason
the control key down wouldn't work so I searched the documentation and
tried:
--if controlKey() is down then
Which also didn't work and
--If the controlKey() is down then
Which made errors and
--If the controlKey is down then
Which also didn't work. All of this is on a MacOS X system and I'm putting
the mouseDown handler in the card script. I was getting frustrated so I cut
and pasted this from the documentation of RunRev:
on controlKeyDown myKey -- make Control-D delete the current card
if theKey is "D" then delete this card
else pass controlKeyDown
end controlKeyDown
And that didn't work (good thing as I didn't want to delete that card
anyway) so I was pulling my hair until I noticed the typo for "theKey"
instead of "myKey" cleverly put in by the runrev documentation team to keep
us hopping. But it still wasn't trapping the mouseDown with control key like
I wanted and then I found:
on mouseDown theButton -- make database find on Control/Right-click
if theButton is 3 then
ask "Find... in" && the name of the target
else
pass mouseDown
end if
end mouseDown
Which works absolutely perfect and does what someone posted earlier. The
"theButton" is 3 means that we are holding the control key down an a
mousedown and it works perfectly. I posted this in case someone else tried
to make the earlier mousedown handler work so they wouldn't have to go
through all the same frustrations.
More information about the use-livecode
mailing list