Child Window Can't be Recreated

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

 




----- Original Message -----
Date: Fri, 24 Apr 2009 20:05:05 +0800
From: ??? <wispernano@xxxxxxxxx>
Subject: [gtkbuilder] when destroyed, the window cannot open again
To: gtk-list@xxxxxxxxx
Message-ID:
        <a4dfa4410904240505j7d28d31bn675851b90dfdebcc@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="utf-8"

I wirte a sample application use GktBuilder + glade3. there are one
main-window(top level) and some other child-window (top level too, creat and
show when the menu item is actived, in my code it is named window_rank).
after close the child-window for first time, i click the menu item again.
But this child-window cannot be created and showed again. with many errors
or warming like this:

(lsacs_gsecu:11866): GLib-GObject-WARNING **: invalid unclassed pointer in
cast to `GtkCList'

(lsacs_gsecu:11866): Gtk-CRITICAL **: gtk_clist_append: assertion
`GTK_IS_CLIST (clist)' failed

(lsacs_gsecu:11866): GLib-GObject-WARNING **: invalid unclassed pointer in
cast to `GtkCList'

...

etc.

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

I had the same problem with my first Glade 3-based GUI. What you need to do is i connect to the "delete-event"

in the child-window code, as follows:

 

    g_signal_connect(GTK_WINDOW(cwin), "delete-event",                // I used cwClose for the callback,
                     G_CALLBACK(cwClose_window), NULL);                     // but you can use any name you want.

 

 and then write the callback function, also in the child window code, as follows:

 

gboolean cwClose_window(GtkWidget *window, GdkEvent *event, gpointer user_data)
{
    gtk_widget_hide(GTK_WIDGET(cwin));
    return TRUE;
}

 

This "Hides" the window, rather than disposing of it, when the delete-event is triggered, so that when you try to open the child-window again, it will be revealed.

 

Hope this helps.

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux