Re: [gtk-list] GTK--: hello.cc questions



Ionut Borcoman at debian <borco@mailbox.ro> writes:
> I am trying my first GTK-- application. I have GTK---0.9.9 and
> GTK+-1.0.4.
> 
> Problem 1:
> I have compiled the hello.cc and run it. If I press the button b,
> everithing's OK. But if I close the window via the window manager, I get
> this:
> 
> bash-2.01$ ./hello
> 
> ** WARNING **: file gtkobject.c: line 1140 (gtk_object_get_data_by_id):
> "GTK_IS_OBJECT (object)"
> 
> ** WARNING **: gtk_signal_disconnect(): could not find handler (1)
> 
> Why do I get these messages ?

I dont know :) never seen these bbefore :)

> Problem 2:
> I would also like to be able to control the closing of the window (to
> prevent unsaved work to be lost). How can this be done ?

overriding delete_event_impl -- not destroy_event_impl...
return value of it determines if gtk automatically destroys
the widget and with gtk-- it should always be 0. (I think)

> Problem 3:
> Another question is related to the function from hello.cc, too:
> 
>   gint destroy_event_impl(GdkEventAny *){
>     Gtk_Main::instance()->quit(); 
>     return 0;
>   }
> 
> This function is never called ! Why and how do I make it be called ?
> (this can be checked by changing it in:
> 
>   gint destroy_event_impl(GdkEventAny *){
>     g_print( "destroy event occured\n"); 
>     Gtk_Main::instance()->quit(); 
>     return 0;
>   }
> 
> The message "destroy event occured\n" is never printed.)

I dont really know the original purpose of destroy_event, but
using delete_event_impl seems to work right. 

-- 
-- Tero Pulkkinen -- terop@modeemi.cs.tut.fi --



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