vrihlea
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2017
12:46 AM
base library bslCore.brs
https://sdkdocs.roku.com/display/sdkdoc/Component+Architecture#ComponentArchitecture-v30/bslCore.brs
there are two methods in there that caught my attention:
- bslBrightScriptErrorCodes()
- bslUniversalControlEventCodes()[/font][/color]
a) Is there a way to get the button-press event before it gets to the "onKeyEvent()" in the component ?
one usecase for this would be to disable the quick-play (or the remote) so that it won't be possible to press it multiple times
b)
what would be a possible use-case for bslBrightScriptErrorCodes() ?[/font][/color]
there are two methods in there that caught my attention:
- bslBrightScriptErrorCodes()
- bslUniversalControlEventCodes()[/font][/color]
a) Is there a way to get the button-press event before it gets to the "onKeyEvent()" in the component ?
one usecase for this would be to disable the quick-play (or the remote) so that it won't be possible to press it multiple times
b)
screen = CreateObject("roSGScreen")
m.port = CreateObject("roMessagePort")
screen.setMessagePort(m.port)
' ...
while(true)
msg = wait(0, m.port)
' the roku-remote events are not handled here so what's the point in bslUniversalControlEventCodes()
what would be a possible use-case for bslBrightScriptErrorCodes() ?[/font][/color]
5 REPLIES 5
NB_
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2017
11:20 AM
Re: base library bslCore.brs
"vrihlea" wrote:
a) Is there a way to get the button-press event before it gets to the "onKeyEvent()" in the component ?
one use case for this would be to disable the quick-play (or the remote) so that it won't be possible to press it multiple times
Yes - by temporarily setting the input focus on another node (regardless whether parent or sibling of the current one) and handling it there. Or not handling it (with chance of beep or exit). The point is, excluding the component at hand from the key event handling chain
belltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2017
07:33 PM
Re: base library bslCore.brs
"vrihlea" wrote:
b)
what would be a possible use-case for bslUniversalControlEventCodes() and bslBrightScriptErrorCodes() ?
bslUniversalControlEventCodes() could be used in a 2D API application, which uses an roUniversalControlEvent to convey key press information: https://sdkdocs.roku.com/display/sdkdoc/Runtime+Functions#RuntimeFunctions-Eval(codeasString)asDynam...
vrihlea
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2017
01:23 AM
Re: base library bslCore.brs
"RokuNB" wrote:"vrihlea" wrote:
a) Is there a way to get the button-press event before it gets to the "onKeyEvent()" in the component ?
one use case for this would be to disable the quick-play (or the remote) so that it won't be possible to press it multiple times
Yes - by temporarily setting the input focus on another node (regardless whether parent or sibling of the current one) and handling it there. Or not handling it (with chance of beep or exit). The point is, excluding the component at hand from the key event handling chain
yes I could "unfocus" the current element but the "onKeyEvent" on the "parent component" (the element that I'm focussing) would still get called, is there a way to avoid that ?
I would like to either focus the same "global" node/component from everywhere or find a way to use bslUniversalControlEventCodes()[/font]
I'm trying to figure out how to use bslUniversalControlEventCodes() based on this topic: https://forums.roku.com/viewtopic.php?f=34&t=99328&p=551386&hilit=roUniversalControlEvent#p551386
screen = CreateObject("roSGScreen")
' m.port = CreateObject("roMessagePort")
m.port = CreateObject("roUniversalControlEvent")
screen.setMessagePort(m.port)
while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roPosterScreenEvent"
if msg.isRemoteKeyPressed()
stop
end if
end if
it never gets to the "stop", did I miss something ?


Roku Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2017
01:39 PM
Re: base library bslCore.brs
"vrihlea" wrote:screen = CreateObject("roSGScreen")
' m.port = CreateObject("roMessagePort")
m.port = CreateObject("roUniversalControlEvent")
screen.setMessagePort(m.port)
while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roPosterScreenEvent"
if msg.isRemoteKeyPressed()
stop
end if
end if
it never gets to the "stop", did I miss something ?
The only object that can be used with SetMessagePort is an roMessagePort.
Trying to use an roUniversalControlEvent object as a message port won't do anything.
I guess your intent might have been to receive roUniversalControlEvents,
where you are checking for "roPosterScreenEvent", but that also won't help,
as roUniversalControlEvents are only generated by an roScreen screen, not by
an roSGScreen.
Hope that helps.
vrihlea
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2017
02:42 AM
Re: base library bslCore.brs
so "roSGScreen" works with components (lists, grids ...) and "roScreen" is used for drawing and stuff.
but is there a way to make something like a global-onKeyEvent ?
meaning before a key-press event gets to onKeyEvent in a component it should first go through main()[/color]
but is there a way to make something like a global-onKeyEvent ?
meaning before a key-press event gets to onKeyEvent in a component it should first go through main()[/color]