Re: Closing a window



On Thu, 18 Mar 2004, Ruben Rubio wrote:
I have tried a lot. Im able to open the new window but I dont know how
to close the first one. This is my last code:

on_cmdNext_clicked (GtkButton *button,
                                        gpointer         user_data)
{

  GtkWidget *nextstep;
  nextstep = create_srcStepTwo();
  gtk_widget_show(nextstep);
  gtk_widget_destroy (button); //Here fails How can i get the pointer to
                             // the first window??
}
Hello Ruben,
what you can do for example is move up the widget hierarchy starting with
your button until you find a widget of type GtkWindow. Your code could
look something like:

  GtkWidget *pWidget = button;
  do {
    pWidget = gtk_widget_get_parent(pWidget);
  } while (pWidget && !GTK_IS_WINDOW(pWidget));

After this loop pWidget should contain a pointer to your first window.

Regards,
                      Peter
-- 
====================================================================
Peter Krüger

applied software solutions (appss) GmbH
Sandtorstr. 23
D-39106 Magdeburg
Germany

Phone:  +49-(0)391-54486-19388
Fax:    +49-(0)391-54486-19222
email:  krueger appss de
URL:    http://www.appss.de

Managing Director: Uwe Hess, Dietmar Schäfer
Register: HRB12386, AG Mageburg

"Virtual business becomes reality!"

This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient (or have received this e-mail in
error) please notify the sender immediately and destroy this e-mail. Any
unauthorised copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.
====================================================================




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