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

Re: passing data to Menu handler function



Thanks for your answer, Gustavo,

>If you *have* to use 'gtk_signal_connect_object', then you should attach
>data to the object the receives the event (the last GTK_OBJECT(..) in
>'gtk_signal_connect_object'), with 'gtk_object_set_data'.

Yes, I guess this probably solves my problem. Again, thanks a lot. 

If I try to use gtk_signal_connect:

gtk_signal_connect (GTK_OBJECT (button), "event",
                           GTK_SIGNAL_FUNC (activate_menu), data);

I am not saying which menu I am talking about. Of course I could
pass this information inside the data structure, as data->menu,
but that is not going to work, because the signal handler requires to
know the widget, before it is executed... I suppose I have really
to use gtk_signal_connect_object to let GTK know where is the menu:

gtk_signal_connect_object (GTK_OBJECT (button), "event",
                           GTK_SIGNAL_FUNC (activate_menu),
                           GTK_OBJECT (menu));


If I am wrong, please correct me...
Menu is a very special GTK widget (no gtk_widget_show, for instance...),

Carlos Pereira,
Technical University of Lisboa
Portugal



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