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

Closing a single window programmatically (was: RE: erasing (cleaning) drawing area)



>   One other thing... i need a function that closes (or kill) juas a dialog
window... >(a
>message
>window)... not to quit the entire program...
>
>   Tnx
>
>                                Rodrigo Domingues
>                                spy@ufu.br

According to the tutorial, there's a neat little function for this sort of
thing:

void gtk_signal_emit_by_name( GtkObject   *object,
                              const gchar *name,
                              ... );

(note I have no idea what the "..." stands for; I can use the function fine,
without supplying anything there. I assume it's if I want to send more than
one signal at once. I'm at work right now (on a 'doze box), so I can't
easily check out the Gtk+ headers at the moment...)

So the really easy way to do this should be to

gtk_signal_emit_by_name( GTK_OBJECT( mywindow ), "destroy" );

... and that should take care of the problem. Assuming, of course, that
GtkWidget *mywindow;
is the window you want to close :-)

Kepp in mind I haven't actually used this function for this purpose myself;
it is possible that there are unforseen side-effects. For example, Gtk+
supports signal propogation up the tree in your program. So, it's entirely
possible that you may end up "destroy"ing other things as well. In which
case, use the equivalent function:

void gtk_signal_emit_stop_by_name( GtkObject   *object,
                                   const gchar *name );

hence:

gtk_signal_emit_stop_by_name( GTK_OBJECT( mywindow ), "destroy" );

... where the "stop" in the function name tells Gtk+ not to propogate the
signal. Note also that this function does not have a "..." after the first 2
arguments.

Hope it helps,
   - Sean



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