Re: [gtk-list] Modal windows



> How can I create modal windows? I want a window that is the only window of
> my app that is active (like message dialogs under Windows).
> Normally when I create a second window with gtk_window_new the first window
> is still active...

  I think that I posted it some time ago, maybe it's in archive. And I think
that Andy will not flame me for obscene code this time. :-)
  Apparently this soltion isn't capable of gtk_window_set_modal(*,FALSE)
but it will probably not be needed in your app anyway.


------------------------------------------------------------------------------
#include <gtk/gtk.h>

#if (GTK_MAJOR_VERSION>1) || ((GTK_MAJOR_VERSION==1) && (GTK_MINOR_VERSION>0))
#define HAVE_GTK11
#endif

#ifndef HAVE_GTK11
#include <assert.h>

void gtk_window_set_modal(GtkWindow *window,gboolean modal)
{
        assert(modal);
        gtk_signal_connect_object(GTK_OBJECT(window),"show",GTK_SIGNAL_FUNC(gtk_grab_add   ),GTK_OBJECT(window));
        gtk_signal_connect_object(GTK_OBJECT(window),"hide",GTK_SIGNAL_FUNC(gtk_grab_remove),GTK_OBJECT(window));
}
#endif
------------------------------------------------------------------------------


> Regards
> Udo Giacomozzi
				Hope it helps,
					Lace



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