[Glade-users] Closing windows properly.
- From: de.techno at gmail.com (dE)
- Subject: [Glade-users] Closing windows properly.
- Date: Mon, 27 May 2013 23:11:27 +0530
On 05/26/13 14:14, Tristan Van Berkom wrote:
On Sun, May 26, 2013 at 5:30 PM, dE<de.techno at gmail.com> wrote:
On 05/26/13 12:46, Tristan Van Berkom wrote:
On Sun, May 26, 2013 at 4:04 PM, dE<de.techno at gmail.com> wrote:
I happens that whenever I get a window opened, and then I close it (no
signal associated with close), and then again if that windows is opened,
all
I get is a small blank window.
I doubt this's cause the window is not closed properly (default handler
is
not good enough).
So what should be done? Thanks for the help!
I don't exactly understand what is going wrong... but if you want to
handle
the event where a window is closed, you should handle the "delete-event"
signal on your window:
https://developer.gnome.org/gtk3/unstable/GtkWidget.html#GtkWidget-delete-event
Cheers,
-Tristan
_______________________________________________
Glade-users maillist -Glade-users at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/glade-users
You mean this shouldn't happen?
No, I mean I have no idea what it is that is happening, I'm just guessing
that you need to receive an event for closing a window.
Even if I do not have any event related to
closing of the window,
You do have an event, it's "delete-event", only that you are not
handling that event.
it should appear again if the same function is
evoked? Here's the code --
void msgs (char *msg) {
GtkWidget *msg_window;
msg_window = GTK_WIDGET(gtk_builder_get_object( build_object, "dialog1"
));
gtk_label_set_text_with_mnemonic ( detect_object ("label3"), msg );
gtk_widget_show ( msg_window );
}
No, if the 'msg_window' here is closed, the default behaviour for the
'delete-event'
is to call gtk_widget_destroy(), so it will not exist again.
If you want to reuse it, you should handle the 'delete-event' signal
and return TRUE
from there (and probably call gtk_widget_hide() to hide the window
when it's deleted).
I'm using the same build object as for the main window of the application.
You can do that but I would recommend you split up your glade file into multiple
files.
Also I would recommend you get rid of the GtkBuilder object directly after
using it.
If this function is evoked more than twice in a single run, all windows
except the 1st one will open properly, all subsequent windows will be blank.
That's correct, because once you close the window it's destroyed, unless
you override that behaviour by handling the 'delete-event' signal.
Common practice is also to just rebuild the dialog from it's own glade file
whenever you need it.
Cheers,
-Tristan
I rebuild, and it works. Thanks!
Another question --
How do I get a list of default handlers? Cause I'm trying to close a
window (msg_window) with push of a button, but --
gboolean close_window ( GtkWidget *temp , GdkEvent *event, gpointer
*target ) {
gtk_widget_destroy ( GTK_WIDGET( target ) );
}
Doesn't help.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]