Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Previous section Next section Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Topic:
OnHold Function/Event
This thread has 4 replies. Displaying all posts.
Post 1 made on Friday October 3, 2008 at 15:21
RomstadtJ
Long Time Member
Joined:
Posts:
June 2008
11
Is there any way using the following code to exit the OnHold Event before the user lets go of the button?

onHoldInterval = 100; // ckeck every 1/10 of a second

var c = 0; // clear the counter
onHold = function()
{
c= c +1;
if (c > 10)
{
onHold = null; // Fails to exit onHold while button is still pressed!
return;
};
};

I know the 30 second limit but i must be just missing this.

Thanks Guys.
Post 2 made on Friday October 3, 2008 at 15:49
André du Fresne
Founding Member
Joined:
Posts:
April 2002
783
RomstadtJ,
why not go the other way round?

onHoldInterval = 100; // ckeck every 1/10 of a second

var c = 0; // clear the counter
onHold = function()
{
;
if (c<=10) c++; // increase counter while less/equal 10
};

By doing this, the counter only gets incremented until it reaches ten. The user can then press the button as long as he wants... it will never get to 11.
Regards
André
TSU-9600, URC MX-3000, ProntoProNG TSU-7000
Post 3 made on Friday October 3, 2008 at 16:59
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
13,006
When you want to exit onHold, simply return but prior to doing so, inside of the onHold function issue. I must admit I did not analyze the code above in great detail but I know I've done this before.

delete this.onHold; //will remove the function from the widget.
this.onHoldInterval = 0; // keeps function from being called again.

return;
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 4 made on Saturday October 4, 2008 at 09:50
RomstadtJ
Long Time Member
Joined:
Posts:
June 2008
11
Thanks, but that still not working how I would like it expected or as I should say as I like it to work.

This is what I am trying to accomplish.

When a Hard key is pressed carry out two different functions.

1) for a press and release do_this_1;
2) for a press and hold do_this_2;

But I only wish to wait for 3/4 of a seconds to 1 second for it to register the second option.

The problem occurs when hard hey continues to be held past the 1 second mark.

onHoldInterval = 100;
var c = 0;

onHold = function()
{
if (c <= 10)
{
c++;
}
else
{
delete this.onHold; //will remove the function from the widget.
this.onHoldInterval = 0; // keeps function from being called again.
//System.print ( "hold C:" + c);
this.onRelease();
//return;

}

};

onRelease = function()
{
if (c===null) return;
System.print ( "relase C:" + c);
delete this.onRelease;
delete c;
};
Post 5 made on Saturday October 4, 2008 at 10:13
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
13,006
First off, I would not use counters coupled with a hold interval. I'd use new Date().valueOf() to get the actual time in MS when button was pressed and save in a variable. then in onHold, use the same expression for purposes of calculating a millisecond delta time.

Instead of
this.onHoldInterval=0;
try
onHoldInterval = 0;

I don't believe that you can "force" a release to be called on a button, that is, tell the remote to move on to 'onRelease' The instructions I presented indicated how to keep onHold from being called. There is no user control over onRelease.
Lyndel McGee
Philips Pronto Addict/Beta Tester


Jump to


Protected Feature Before you can reply to a message...
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now.

Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.

Hosting Services by ipHouse