Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
nmaves
Visitor

Best way to prevent double clicks

I have a grid of titles inside of a panelset.  When you select a title it will append a panel to display that titles detail information.  If you double click the "ok" button on that grid it will append two detail panels.

What is the best way to prevent this?
0 Kudos
2 REPLIES 2
joetesta
Roku Guru

Re: Best way to prevent double clicks

as soon as the first click is received set a flag m.inProcess = true or something.  In your init sub, set m.inProcess = false.  In your onKeyEvent check if m.inProcess then return true so the click is ignored.  When your thing finishes adding or later goes away you need to set m.inProcess back to false so you start listening for clicks on that screen / component again.
aspiring
0 Kudos
tim_beynart
Channel Surfer

Re: Best way to prevent double clicks

what is your keypress code? the firmware fires both "press" and "release" events for a single button click. for example:

' press is true for the down phase, false for the release phase . 
function onKeyEvent(key, press) as Boolean
if press
...do stuff...
end if
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.