IRRemote: Disabling / Delaying the repeated send function

Software related support

Moderator: marcus

IRRemote: Disabling / Delaying the repeated send function

Postby redlaser » Thu 9. Apr 2015, 16:05

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
redlaser
 
Posts: 3
Joined: Mon 6. Apr 2015, 20:20

Re: IRRemote: Disabling / Delaying the repeated send functio

Postby redlaser » Fri 10. Apr 2015, 14:40

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
redlaser
 
Posts: 3
Joined: Mon 6. Apr 2015, 20:20

Re: IRRemote: Disabling / Delaying the repeated send functio

Postby eric » Fri 10. Apr 2015, 15:49

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?
eric
Administrator
 
Posts: 157
Joined: Mon 22. Oct 2012, 10:05


Return to Software

Who is online

Users browsing this forum: No registered users and 1 guest

cron