Page 1 of 1

IRRemote: Disabling / Delaying the repeated send function

PostPosted: Thu 9. Apr 2015, 16:05
by redlaser
Hello,

I have already got an official answer for a workaround from Eric directly, but wanted to make sure there is no alternative for me than dealing with java :)

I would like to disable or at least significantly delay the repeat sending function which occurs when you press and hold a button in IRRemote. Did anybody have this problem too?

Kind regards,
Viktor

Re: IRRemote: Disabling / Delaying the repeated send functio

PostPosted: Fri 10. Apr 2015, 14:40
by redlaser
And a related question for the javascript experts: how can I create a button for JavaRemote which triggers the signal only when releasing the pressed button? Right now the "AddRemoteButton" function triggers the signal already on pressing the button instead of on release of the button.

Kind regards,
Viktor

Re: IRRemote: Disabling / Delaying the repeated send functio

PostPosted: Fri 10. Apr 2015, 15:49
by eric
Have a look at the code:
Code: Select all
document.getElementById(num).onmousedown = function () { SendIRCommand (num,remote,command,led,initial_delay,repeat_delay) };
    document.getElementById(num).onmouseup = function () { EndSendCommand (num) };
    document.getElementById(num).onmouseleave = function () { EndSendCommand (num) };


"onmousedown" -> pressing the mouse button
"onmouseup" -> releasing the mouse button
"onmouseleave" -> when leaving the button area with the pointer although the button is still pressed

Be advised that starting the send function on releasing the button is not a good idea. This will not work reliably with some mobile devices. Also when will you call the "EndSendCommand" function in such a scenario?