Re: Closing a window
- From: Harring Figueiredo <harringf yahoo com>
- To: Iago Rubio <iago rubio hispalinux es>, "gtk-app-devel-list gnome org" <gtk-app-devel-list gnome org>
- Subject: Re: Closing a window
- Date: Thu, 18 Mar 2004 06:31:39 -0800 (PST)
<imho>
From your description, it seems that you are creating some type of "installer"
application.
Why don't you use gtknotebook (and Hide the tabs )? I think that this is a
better/faster/cleaner solution.
</imho>
Harring.
--- Iago Rubio <iago rubio hispalinux es> wrote:
On Thu, 2004-03-18 at 13:50, Toth Zoltan wrote:
On Thu, 2004-03-18 at 11:46, Ruben Rubio wrote:
[snip]
The think is, im creating a GTK app using Glade, and I want when a
person click on next it will create a new window and will close the
first one.
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;
GtkWidget *oldwindow;
nextstep = create_srcStepTwo();
gtk_widget_show(nextstep);
oldwindow=lookup_widget( button , "window1");
// in interface.c : GLADE_HOOKUP_OBJECT_NO_REF (window1,
window1, "window1");
gtk_widget_destroy( oldwindow );
//gtk_widget_destroy (button); //Here fails How can i get the pointer
to
// the first window??
}
The lookup_widget() stuff is ok if you're using Glade2, but not the Gtk
way of doing this things ;)
As example, this function is not defined in a Glade generated project
but in a Glade-2 generated one.
To get the window pointer using only Gtk functions, you can pass it as
user_data when you connect the clicked signal:
g_signal_connect(button, "clicked", on_cmdNext_clicked,
pointer_to_window);
Then the pointer is passed to your callback, and you can use it as
needed:
void
on_cmdNext_clicked (GtkButton *button, gpointer user_data)
{
GtkWidget *nextstep;
GtkWidget* window;
window = GTK_WIDGET(user_data);
nextstep = create_srcStepTwo();
gtk_widget_show( nextstep );
gtk_widget_destroy( window );
}
I'm not telling you to don't use lookup_widget(). It's really usefull.
It's just to tell you that lookup_widget() is not a Gtk function but a
Glade defined function.
You can take a look at this function in the support.c file generated by
Glade.
Hope this helps.
--
Iago Rubio http://www.iagorubio.com
GPGkey pgp.rediris.es id 0x909BD4DD fingerprint =
D18A B950 5F03 BB9A DD89 AA75 FEDF 1978 909B D4DD
********** iago.rubio(AT)hispalinux.es **********
--------------------------------------------------
ATTACHMENT part 2 application/pgp-signature name=signature.asc
__________________________________
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]