|Topic was automatically imported from the old Question2Answer platform.
|Allen Kennedy Jr.
What is a modal dialog? It’s a window of some sort that does a minimum of 2 things:
- Disallows input to anywhere else in the program until it is closed
- Blocks program execution until closed.
I’ve by trying for hours to use combinations of the functions, “popup” “yield” and “Show modal” to get this to work.
This is as close as I can get:
my WindowDialog scene has a function called, “do_modal” In this function I call popup() then call “yield(self, “popup_hide”)” I have a button in the scene that calls hide() Yes, the “Exclusive” checkbox is checked.
Else where in my program, I instance the MyWindowDialog, add_child() to put it in the tree and call do_modal().
I would expect execution to stop at the yield function and resume when I hide the pop-up. What actually happens is that execution returns immediatley from the do_modal() function to where I had created and added the dialog - causing issues as the data that the dialog would create has yet to be created.
THe documentation indicates that the Yield function pauses execution, but this appears to not be the case. In fact the Yield function seems to return from the executing function to the next in the call stack, and allows re-entry to the called function from the yield function, at a later time point when the signal is met. Which causes the call stack to be executed and unwound twice.
So, Failing on requirement 2 of a modal.
Further… given that execution return… lets say I can detect that and skip the errors… The Dialog does show up, BUT it still allows input to the rest of the scene. I have the arrow keys mapped to moving the camera, and pressing the arrow keys while the dialog is up Still moves the camera despite Exclusive being checked and supposedly being ‘modal’
So that fails requirement 1 of a modal.
Any ideas how to actually make a real live modal dialog?