gaurachit
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2015
05:51 AM
roImageCanvas event handling
Hi,
I want to handle the situation where roImageCanvasEvent is making a stack.
Consider the scenario:
app is fetching the data from web-service, at the same time if I press the remote keys continuously then all the roImageCanvasEvent are accumulate and make a stack and execute after the web-service response received.
I need to ignore the roImageCanvasEvent when I am trying to get the data from service or any other situation like this.
Is any built in property available to handle this or any workaround ? Please let me know.
Thanks
I want to handle the situation where roImageCanvasEvent is making a stack.
Consider the scenario:
app is fetching the data from web-service, at the same time if I press the remote keys continuously then all the roImageCanvasEvent are accumulate and make a stack and execute after the web-service response received.
I need to ignore the roImageCanvasEvent when I am trying to get the data from service or any other situation like this.
Is any built in property available to handle this or any workaround ? Please let me know.
Thanks
9 REPLIES 9
belltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2015
09:45 AM
Re: roImageCanvas event handling
Fetch the data from your web service asynchronously, so while you're waiting for the transfer to complete you can also be handling (and ignoring if you wish) the key presses on your image canvas.

RokuMarkn
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2015
09:53 AM
Re: roImageCanvas event handling
You could also use separate message ports for the image canvas and the transfer.
--Mark
--Mark

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2015
05:35 PM
Re: roImageCanvas event handling
You could also spin through all of the queued events when your web service request returns, and ignore all but the last one.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
gaurachit
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2015
12:49 AM
Re: roImageCanvas event handling
"TheEndless" wrote:
You could also spin through all of the queued events when your web service request returns, and ignore all but the last one.
Hi TheEndless,
From where I will get the list of queued events and how can I ignore them?
gaurachit
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2015
12:56 AM
Re: roImageCanvas event handling
"RokuMarkn" wrote:
You could also use separate message ports for the image canvas and the transfer.
--Mark
Hi RokuMarkn,
I am using the separate ports for ImageCanvas and urlTransfer but not able to handle this is there any trick to handle this kind of situation.
Actually I have separate method here for urltransfer where I am using a new port different from the ImageCanvas port.
Thanks

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2015
09:23 AM
Re: roImageCanvas event handling
"gaurachit" wrote:"TheEndless" wrote:
You could also spin through all of the queued events when your web service request returns, and ignore all but the last one.
Hi TheEndless,
From where I will get the list of queued events and how can I ignore them?
roMessagePort.PeekMessage() and roMessagePort.GetMessage()
Something along these lines might work:
msg = invalid
While Type(canvas.GetMessagePort().PeekMessage()) = "roImageCanvasEvent"
msg = canvas.GetMessagePort().GetMessage()
End While
Return msg
Assuming your canvas has it's own port, this would dequeue and discard all but the last roImageCanvasEvent. You can/should refine it to deal with any events you don't want to ignore (e.g., isScreenClosed()).
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)

RokuMarkn
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2015
10:48 AM
Re: roImageCanvas event handling
Hm, although it wasn't phrased very clearly, I thought the OP's request was to queue the ImageCanvas events for later processing, not to discard them.
--Mark
--Mark

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2015
12:29 PM
Re: roImageCanvas event handling
"RokuMarkn" wrote:
Hm, although it wasn't phrased very clearly, I thought the OP's request was to queue the ImageCanvas events for later processing, not to discard them.
--Mark
No, he said the problem is that they queue up while the message loop is blocked during the web service request and processing. The end result is that he gets a flood of isRemoteKeyPressed() events after the web service request completes. At least that's how I read it.
Another solution would be to put up a wait dialog or another image canvas with a wait message in front of the canvas in question, so the keypresses are intercepted by that dialog/screen, and never make it to the original canvas.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
gaurachit
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2015
11:44 PM
Re: roImageCanvas event handling
Hi All Thanks for response,
I am able to solve this situation by adding one more transparent canvas over the main canvas which handles the unwanted events.
Thanks for support.
I am able to solve this situation by adding one more transparent canvas over the main canvas which handles the unwanted events.
Thanks for support.