RE: Avoiding multiple child-windows



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:inodal teleline es]
> 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
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
> 




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