I'm attempting to create a Dialog window from the main code, unfortunately the example program is missing this detail so I am wondering if there is an example or documentation available that shows how to create a dialog screen while blocking any entry to the main screen.
I've just started to try dialogs too and (so far) I don't think it's possible. At least, not for ooRexx and GTK on the Mac.
The reason I say this is that in the ooRexx case, you have to use DW_main_iteration and not Rexx callback functions. Once you call the dw_dialog_wait() function, you no longer receive events. Even then, SYSMODAL doesn't seem to block events to other windows like it's supposed to.
Of course, there's always the possiblity that I completely wrong and am just being too stupid to figure it out.
You can get most of the way there by dw_window_disable()ing the parent windows and just using dw_window_new() as your dialog. It's not perfect as the "dialog" window will not stay on top of its parent as you'd expect. Also, you have to play some tricks with the dw_main_iteration() loop (if that's what you're using) so that the proper callbacks are called.
To get around the "stay on top" problem, I added a bit of code to dw_window_new() to set the window transient (gtk_window_set_transient_for()) if a new flag, DW_FCF_FLOATONPARENT is specified. Combining that and dw_window_disable()ing the parent create a nice "pseudo" dialog.
Okay I think I am there (thank you).
Based on the hint above what I did was create a new Rexx script for the dialog that has its own calls to DW_Init, DW_Window_New and its own event loop.
In the main program I then
1) call DW_window_disable
2) call the dialog script
3) on return from the dialog
This seems to work fine, although as you note above, the "dialog" window will not stay on top of the parent window. Still its a good workable solution to the problem and has the benefit of encapsulation the dialog code in its own script/program.
Minor problem is that the dialog can also be called from the command prompt and not necessarily from just the parent, so code has to be in place to detect this "illegal" call.
Very good and thank you again for the start on this.
Did you build dwindows yourself? IF so, I can send you a patch to add the "stay on top" flag. I've only done it for GTK, but I should be able to do the same for Windows (it would even be easier).
Are you using Regina? I would expect it to NOT have any problems with the dw_dialog_*() functions.
Just let me know...
I'm not sure I have the resources to build dw - I develop primarily for OS/2 and in a small way for windows. So let me poke around a bit to see what's required to do the build on OS/2 and then I might get back to you for the fix.
Log in to post a comment.