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.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Access Stack to Refresh Screen?

Hello again,

Is there any way to access the stack directly? I'm guessing not, from what I've seen, but I have a problem:

I'm editing details on a later screens that affect those below it in the stack. Then, when that child screen closes, I need a way to refresh the (now) current screen. I've seen someone say something about opening any window that needs to be refreshed in a while loop so that it will "re-open" as soon as I exit it, but then that means every single action that could ever impact that screen must return something, which then goes to the page which again has to return to it's parent, and so on, basically traversing up the stack and then going back DOWN it and re-opening everything. This seems wildly ineffecient.

I hope I explained that properly.
0 Kudos

Re: Access Stack to Refresh Screen?

While not actually knowing what you want to do, you probably can get some ideas from this:

if you do not use Associative arrays as objects then you can create a state object at the global level that would be visible to all your screens. Each window in turn could modify the fields in the AA and then the lower window can check the AA. If there are any changes to the window itself you would make them before closing the one above
You an even keep references to other windows in that array. Or to other components or objects that are in the lower windows can also be referenced. Say you wanted the window above it to change something, you just have the lower window put a reference to itself into a field in the array before opening the one above it at the start
When the stack returns to the window above it, it checks the state made my the windows above, and uses the window handle of the window below it to make changes before closing. Of course that would depend on what you want to do.

' At the global level using the m pointer create a state variable. You would of course define the fields that you need.
Function Main(() As Void

m.MyState = {
VideoPlayed: False
Screen: ( place reference to lower screen or lower screen object )
Response: ""
ErrorCode: 0
ErrorMessage: "" }
End Function

Then in each event loop for your windows up the stack they would modify the AAm.MyState.VideoPlayed = False
m.MyState.Response = "Would not Load"
m.MyState.ErrorCode = 403
m.MyState.ErrorMessage = "Access Denied"

When control returns to the windows lower in the stack they check the AA
if ( m.MyState.VideoPlayed ) then DoSomething()
if ( m.MyState.ErrorCode <> 0 ) then ShowMessage( m.MyState.ErrorMessage )
My Channels: 2D API Framework Presentation:
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
0 Kudos

Re: Access Stack to Refresh Screen?

I think I get what you're saying and will give it a shot, thanks.
0 Kudos