Re: gtk_main question




A Dark Elf <drow@DarkElf.net> writes:

> Ok I messed with GTK for a while, but it seems I can't quit gtk_main() the
> way I need to. I have an app that simply needs to call a message box
> (dialog) at one time, wait for the user to press OK, destroy the message
> box and continue its execution. How would I do that? I made the dialog
> appear, but when the user press OK, either the window stays there (if I
> use gtk_widget_destroy and gtk_main_quit) and the program can continue, or
> the window disapears but everything hang there (if I use only
> gtk_widget_destroy) while gtk probably stays in the gtk_main loop.
> 
> What am I doing wrong here?

The problem is that gtk_main_quit() quits the loop immediately,
while their still are things in the buffer of queued requests to X.
So, you need to flush that buffer.

  gtk_main_quit ();
  gdk_flush ();

Otherwise, X won't destroy the window until your application
terminates.

Regards,
                                        Owen



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