:origin()/pre09/5c9d/th/pre/i/2015/261/4/8/windows95programsicon_by_scorpiongamer01-d9a1oi6.png)
mape
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2017
01:41 AM
Really modal dialog
Hello.
In Scene Graph SDK we have a Dialog component. It looks like a modal, but doesn't behave as a modal in the code.
Here is explatation:
"after show" outputs to console immediately.
So, I must to observe a field and catch dialog closing in event-driven style.
Can I do REALLY modal dialog, that stops other statement execution while dialog shown? Another words, to make and use function like this:
Thank you.
In Scene Graph SDK we have a Dialog component. It looks like a modal, but doesn't behave as a modal in the code.
Here is explatation:
m.top.dialog = m.dialog
print "after show", m
"after show" outputs to console immediately.
So, I must to observe a field and catch dialog closing in event-driven style.
Can I do REALLY modal dialog, that stops other statement execution while dialog shown? Another words, to make and use function like this:
result = askDialog() ' <- dialog invoked here.
Thank you.
11 REPLIES 11
EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2017
12:20 PM
Re: Really modal dialog
It not only looks - it is a modal dialog. The meaning of a modal dialog is blocking the user interface and not code execution.
You want your code execution to block till it gets dismissed? Sure, no problem - somewhere in the main or a task thread you can do this quick&dirty:
Do not do that in the render thread however, since it would block screen redraws. Under no circumstance should you delay event execution in the render thread (those being init(), observer functions, input handlers) for long-running code. No sleeping in the render thread! Your app may get terminated, or worse.
You want your code execution to block till it gets dismissed? Sure, no problem - somewhere in the main or a task thread you can do this quick&dirty:
while myScene.dialog <> invalid
sleep(500)
end while
Do not do that in the render thread however, since it would block screen redraws. Under no circumstance should you delay event execution in the render thread (those being init(), observer functions, input handlers) for long-running code. No sleeping in the render thread! Your app may get terminated, or worse.
:origin()/pre09/5c9d/th/pre/i/2015/261/4/8/windows95programsicon_by_scorpiongamer01-d9a1oi6.png)
mape
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2017
03:41 AM
Re: Really modal dialog
No, the dialog isn't real modal because current thread not stopped.
I had try to make endless for-cycle in the Scene thread and Dialog thread.
The render process stopped, as you say.
So, it seems that I need to make this cycle exactly in render thread. Any ideas?
I had try to make endless for-cycle in the Scene thread and Dialog thread.
while True
end while
The render process stopped, as you say.
So, it seems that I need to make this cycle exactly in render thread. Any ideas?
EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2017
08:24 PM
Re: Really modal dialog
You'll have to change the way you think about this. You'll have to break your code in two pieces - the one "after" the dialog put in a different function, which is observing for change of say myScene.dialog field - or onKeyEvent() one
See if https://sdkdocs.roku.com/display/sdkdoc/Dialogs+Markup can be of help.
See if https://sdkdocs.roku.com/display/sdkdoc/Dialogs+Markup can be of help.
:origin()/pre09/5c9d/th/pre/i/2015/261/4/8/windows95programsicon_by_scorpiongamer01-d9a1oi6.png)
mape
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2017
12:36 AM
Re: Really modal dialog
"EnTerr" wrote:
You'll have to change the way you think about this. You'll have to break your code in two pieces - the one "after" the dialog put in a different function, which is observing for change of say myScene.dialog field - or onKeyEvent() one
See if https://sdkdocs.roku.com/display/sdkdoc/Dialogs+Markup can be of help.
That mean that it is impossible to make real modal dialog.
Pity.
:origin()/pre09/5c9d/th/pre/i/2015/261/4/8/windows95programsicon_by_scorpiongamer01-d9a1oi6.png)
mape
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2017
12:37 AM
Re: Really modal dialog
destruk
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2017
08:35 AM
Re: Really modal dialog
For a fake modal dialog have you considered pausing all the other routines when it is displayed? That way the render thread would simply be running and not changing anything.
:origin()/pre09/5c9d/th/pre/i/2015/261/4/8/windows95programsicon_by_scorpiongamer01-d9a1oi6.png)
mape
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2017
04:40 AM
Re: Really modal dialog
"destruk" wrote:
For a fake modal dialog have you considered pausing all the other routines when it is displayed? That way the render thread would simply be running and not changing anything.
Not all, just the current thread.
This in not a fake modal dialog, but real 🙂
This is standard behaviour for the modal dialog on traditional systems.
EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2017
11:01 AM
Re: Really modal dialog
"mape" wrote:
Not all, just the current thread.
This in not a fake modal dialog, but real 🙂
This is standard behaviour for the modal dialog on traditional systems.
You don't understand - the render thread is not just any old thread. It is THE thread that draws the UI. THOU SHALT NOT hog the render thread, ever. That is (for Dune fans), "the spice must flow!". Everything you do in scene/component functions/events should be fast and return within milliseconds. Think of every call as a hot potato. You need something more long-lived - do it in main or spin off a Task.
:origin()/pre09/5c9d/th/pre/i/2015/261/4/8/windows95programsicon_by_scorpiongamer01-d9a1oi6.png)
mape
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2017
12:32 AM
Re: Really modal dialog
EnTerr
Thank you for the answer, but you talk about technical specifics. I trust you and don't argue.
But I speak about TEORETHICAL behaviour of the modal dialog. How it should be.
If you right, that just means, that make REAL modal dialog (that behaves as modal on other systems) on Roku is impossible.
Thank you for the answer, but you talk about technical specifics. I trust you and don't argue.
But I speak about TEORETHICAL behaviour of the modal dialog. How it should be.
If you right, that just means, that make REAL modal dialog (that behaves as modal on other systems) on Roku is impossible.