Forum Discussion

EnTerr's avatar
EnTerr
Roku Guru
11 years ago

SetMessagePort() without ifSetMessagePort... how/why?

I am utterly befuddled by this. I was under the impression that ALL BRS components have their methods implemented by way of BRS interfaces. I seem to recollect somewhere it was saying components are just a collection of interfaces and nothing else.

But here is example of it not being the case. By documentation, roParagraphScreen has ifSetMessagePort - but not in practice:
BrightScript Debugger> para = CreateObject("roParagraphScreen")
BrightScript Debugger> ? para
<Component: roParagraphScreen>
BrightScript Debugger> ? getInterface(para, "ifSetMessagePort")
invalid
BrightScript Debugger> para.SetMessagePort(invalid)
BrightScript Debugger> para.ifSetMessagePort.SetMessagePort(invalid)
Interface not a member of BrightScript Component (runtime error &hf3) in $LIVECOMPILE(152)
Same is the case with roListScreen, roCaptionRenderer and probably more.

You can set the port with SetMessagePort() but the interface ifSetMessagePort is not there, how is that possible?

On the other hand, roUrlTransfer delivers on the promise of ifSetMessagePort - and so do many (most?) others:
BrightScript Debugger> url = CreateObject("roUrlTransfer")
BrightScript Debugger> ? getInterface(url, "ifSetMessagePort")
<Interface: ifSetMessagePort>
BrightScript Debugger> url.ifSetMessagePort.setMessagePort(invalid)
BrightScript Debugger> url.setMessagePort(invalid)
BrightScript Debugger>
No RepliesBe the first to reply