Re: Child Window Can't be Recreated
- From: 施德来delai <wispernano gmail com>
- To: gtk-list gnome org
- Subject: Re: Child Window Can't be Recreated
- Date: Mon, 27 Apr 2009 19:23:24 +0800
Thank you for your reply, I had do this before(use delete-event signal). But , sometimes , it will crash after reopen the child-window for five or more times. I don't know why.
anyway , maybe this is the only way to solve the problem.
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.gnome.org/archives/gtk-list/attachments/20090424/d0edc2e6/attachment.html>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]