Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] simple_dialog not truly modal in win32

From: Greg Bell <greg_bell_12@xxxxxxxxx>
Date: Fri, 11 May 2007 16:06:19 -0700 (PDT)
I understand that "Modal windows prevent interaction with other windows in the same application... ", but I assumed it will also block the normal code execution until the dialog returns/closes.
 
I also understand that I could use a callback to call a function to execute the remaining code, but it would make things more complex. Essentially, all I want to do is:
 
myfunc() {
  // setup and initialize a lot of stuff here
  ...
  // get some user input from my modified simple_dialog
  simple_dialog(...);
  // continue executing with the new user input
  ...
}
Having a blocking dialog here would be the easiest solution. But I guess if its not possible, then a callback is the only way. Thanks for your help on this!
 

Stephen Fisher <stephentfisher@xxxxxxxxx> wrote:
On Fri, May 11, 2007 at 11:44:10AM -0700, Greg Bell wrote:

> I'm working with the simple_dialog (gtk\simple_dialog.c) and even
> though it is defined as being modal,

> the calling code path continues execution after the dialog opens,
> without waiting for the user to close the dialog. For example, if I
> have the following code in some location:

I'm no win32 programmer, but I don't think setting the dialog to modal
in GTK+ is meant to make it block execution on any platform. According
to http://developer.gnome.org/doc/API/2.0/gtk/GtkWindow.html#id2772272 :

"Sets a window modal or non-modal. Modal windows prevent interaction
with other windows in the same application. To keep modal dialogs on top
of main application windows, use gtk_window_set_transient_for() to make
the dialog transient for the parent; most window managers will then
disallow lowering the dialog below the parent."

If you want to wait for a dialog to be closed before another action is
performed, try creating your own dialog and use callback functions to
run the code you're waiting to run. Check out the functions in
gtk/dlg_utils.c as we have a number of functions that wrap around GTK+
functions for various reasons (making it easier to code, providing one
function to wrap around separate code for GTK1 and GTK2, etc.) Let us
know if you have any further questions on how to use these functions.


Steve

_______________________________________________
Wireshark-dev mailing list
Wireshark-dev@xxxxxxxxxxxxx
http://www.wireshark.org/mailman/listinfo/wireshark-dev


Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.