RE: RV: Avoiding multiple child-windows



Is there any reason why you couldn't do something slightly different by
retrieving the gdkwindow of the widget after it's been created like this;

> void create_param_window(GtkWidget *widget)
{
	/* Declaring local variables */
	static GdkWindow *window = (GdkWindow *) NULL;

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

	/* Creating new window */
	ParamWindow *NewParamWindow = new_ParamWindow(widget);
	window = GTK_WIDGET(widget)->window;
	gtk_widget_show(NewParamWindow->GetWidget());
}



				-- Stupid Genius

> ----------
> From: 	Ignacio Nodal[SMTP:inodal teleline es]
> Sent: 	Friday, February 23, 2001 4:43 AM
> To: 	alan dugas analog com; GTK-List
> Subject: 	Re: RV: Avoiding multiple child-windows
> 
> The problem is that i'm using a class to create this new window. In my
> main.cpp I have this:
> 
>   gtk_signal_connect_object (GTK_OBJECT(button), "clicked",
> 			     GTK_SIGNAL_FUNC(create_param_window), 
> 			     GTK_OBJECT (window));
> 
> 
> And the callback create_param_window look like this:ç
> 
> void create_param_window(GtkWidget *widget)
> {
>   ParamWindow* NewParamWindow = new ParamWindow(widget);
>   gtk_widget_show(NewParamWindow->GetWidget()); 
> }
> 
> (With GtkWidget* GetWidget() { return _pwindow; } in my ParamWindow.h )
> 
> And it's the constructor of the ParamWindow class who makes
> 	_pwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
> 
> So, I want to create only one "ParamWindow" when THIS button is clicked,
> but maybe I want to create later another window using my ParamWindow
> class for any other purpose.
> Is there anyway to do this? It's quite important for the project I'm
> working in.
> 
> Thanks,
> 
> Ignacio Nodal
> 
> 
> > ----- Original Message -----
> > From: Dugas, Alan <alan dugas analog com>
> > To: <gtk-list gnome org>; Ignacio Nodal <inodal teleline es>
> > Sent: Thursday, February 22, 2001 4:39 PM
> > Subject: 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
> 
> 




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