Page 1 of 1
Prevent a key pressed, to repeat its characters?
Posted: Wed Feb 22, 2017 12:28 pm
by Peter@multidesk.se
I need to prevent the user to keep a button pressed down and thereby gaining more clicks registered than was intended.
Does anyone have any suggestions on how to do this?
Thanks in advance
Peter
Re: Prevent a key pressed, to repeat its characters?
Posted: Wed Feb 22, 2017 1:28 pm
by jmburnod
Hi Peter,
I use this:
Code: Select all
local sStarTime
on opencard
put the milliseconds into sStarTime
end opencard
on mouseUp
put the milliseconds into tTime
if tTime > sStarTime +500 then
beep
else
-- do your stuff
end if
put the milliseconds into sStarTime
end mouseUp
Best regards
Jean-Marc
Re: Prevent a key pressed, to repeat its characters?
Posted: Wed Feb 22, 2017 1:52 pm
by Peter@multidesk.se
Thanks, but I forgot to mention that it is the keyboard buttons, and not mouse click, I need to handle
I use the keyDown message, and that messages will continue to loop as long as the button is pressed, and that is what I want to prevent.
/Peter
Re: Prevent a key pressed, to repeat its characters?
Posted: Wed Feb 22, 2017 1:57 pm
by jmburnod
What about this:
Code: Select all
on rawkeydown pKey
put the milliseconds into tTime
if tTime > sStarTime +500 then
put the milliseconds into sStarTime
pass rawkeydown --or do your stuff
else
--
end if
put the milliseconds into sStarTime
end rawkeydown
Re: Prevent a key pressed, to repeat its characters?
Posted: Wed Feb 22, 2017 4:23 pm
by dunbarx
Peter.
Make sure you include Jean-Marc's earlier openCard handler if you use his second suggestion.
Craig Newman