Re: [gtk-list] Re: Blocking Dialog and Button listening to right,left mouse





OK, what I have now done is the following:
(And I hope this clears the confusion about what I wanted).

I have setup a dialog widget in main(),
It has 3 buttons with one callback each which just sets a global variable,
let's say global_var. In the callback for button 1 this variable is set
to 1, in the callback of button 2 it is set to 2 and so on.

When I need the blocking dialog I call :

gtk_widget_show(dialog);
global_var = 0;
gtk_grab_add(dialog);
while ( global_var == 0 )
  { gtk_main_iteration(); }
gtk_grab_remove(dialog);
gtk_widget_hide(dialog);

switch(global_var)
   {
   case 1 : .....
   case 2 : .....
   ....
   }

This way the user has to select 1 out of 3 options and the application
can handle it in the same function as the dialog was called from.

BTW, I don't know why I am using gtk_main_iteration as opposed to gtk_main()
but I saw it in a previous post.

But as Havoc Pennington pointed out correctly this way I do not handle
if the user kills the dialog with the window decoration.
But I think I can add it easily (I hope).

Thanks to all. 

Ciao Christoph   (grover@hottemax.uni-muenster.de)
+--------------
  finger grover@hottemax.uni-muenster.de for PGP public key
  http://hottemax.uni-muenster.de/~grover/index.html
  What does the NT in Windows NT stand for ?
  Noisome Trash ?    No Thanks ?   Noteworthy Trickeries ?   Newest Tosh ?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]