Re: GTK Modal dialog
- From: John Cupitt <jcupitt gmail com>
- To: Miroslav Rajcic <rajcic sokrates hr>
- Cc: gtk-list gnome org
- Subject: Re: GTK Modal dialog
- Date: Fri, 8 Oct 2004 13:33:15 +0000
This test program woks for me on windows and linux with gtk+-2.4.9.
But maybe I misunderstand your problem?
- the dialog does not appear on the taskbar
- when the dialog is open the main window button does not work (so you
can never have more than one dialog)
- the dialog is always above the main window
-------------------
#include <gtk/gtk.h>
static void
dialog_button_click( GtkWidget *widget, GtkWidget *dialog )
{
gtk_widget_destroy( dialog );
}
static void
window_button_click( GtkWidget *widget, GtkWidget *parent_window )
{
GtkWidget *dialog;
GtkWidget *button;
dialog = gtk_window_new( GTK_WINDOW_TOPLEVEL );
button = gtk_button_new_with_label( "done" );
g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( dialog_button_click ), dialog );
gtk_container_add( GTK_CONTAINER( dialog ), button );
gtk_window_set_modal( GTK_WINDOW( dialog ), TRUE );
gtk_window_set_transient_for( GTK_WINDOW( dialog ),
GTK_WINDOW( parent_window ) );
gtk_window_set_position( GTK_WINDOW( dialog ),
GTK_WIN_POS_CENTER_ON_PARENT );
gtk_widget_show_all( dialog );
}
int
main( int argc, char **argv )
{
GtkWidget *window;
GtkWidget *button;
gtk_init (&argc, &argv);
window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
button = gtk_button_new_with_label( "click to open dialog" );
g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( window_button_click ), window );
gtk_container_add( GTK_CONTAINER( window ), button );
gtk_widget_show_all( window );
gtk_main();
return( 0 );
}
----------------
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]