You could try something like this;

/* Declaring local variables */
static GtkWidget *window = NULL;
...

/* Return if window already exists */
if ( window )
{
        gdk_window_raise(GTK_WIDGET(window)->window);
        return;
}

/* Creating window */
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
...

[Note: make sure you set window == NULL in your destroy callback for the window,
otherwise you will not be able to create the window again if the user destroys
it!]

Hope this helps.



                                -- Stupid Genius
> ----------
> From:         Ignacio Nodal[SMTP:[EMAIL PROTECTED]]
> Sent:         Thursday, February 22, 2001 10:28 AM
> To:   GTK-List
> Subject:      Avoiding multiple child-windows
> 
> Hi,
> 
> I've got a callback for a button's clicked event that creates a child
> window. If I click this button several times it creates each time a new
> window. How can i ensure that only one windows will be created?
> Which kind of window will be better for my child window?
> 
> Thanks,
> Ignacio Nodal
> 
> _______________________________________________
> gtk-list mailing list
> [EMAIL PROTECTED]
> http://mail.gnome.org/mailman/listinfo/gtk-list
> 

_______________________________________________
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to