Re: MenuItems and events in Gtk2.0



On Thu, 2003-02-13 at 19:53, Jon Wilson wrote:
> I am trying to get menuitems to respond to the mouse clicking them in 
> GTK-2.0 on windows. Everything builds ok and all my other events to 
> update the status bar when hovering over menuitems and close the main 
> window work. However, I cannot get the menuitems to do anything! I am 
> using the old gtk-1.4 way of coding here:
> about=gtk_menu_item_new_with_label("About"); 
> gtk_signal_connect_object(GTK_OBJECT(exitItem),"activate",GTK_SIGNAL_FUNC(eventDestroy),NULL); 
> 
> gint eventAbout(GtkWidget* widget,GdkEvent *event,gpointer data);
> 
> but I have tried in the new 2.0 style.
> g_signal_connect_object(G_OBJECT(exitItem),"activate",G_CALLBACK(eventDestroy),NULL); 
> 
> gulong eventAbout(GtkWidget* widget,gpointer data);
> 
> However, in neither case do the events actually fire! I am using the 
> latest binaries from the win32 port page from gtk.org as of sending this 
> mail. Can anyone explain this?

You apparently are not getting the "stderr" for your program, since 
the second line above (and I think also the first) will certainly
be generating errors at runtime.

gtk_signal_connect_object() is like g_signal_connect_swapped() - it
reverses the order of the arguments passed to the callback

g_signal_connect_object() is used when the user data argument is 
an object. So, in particular, not NULL. The prototype doesn't
match what you have above though, so you apparently not getting
your compiler warnings either :-)

(http://developer.gnome.org/doc/API/2.2/gobject/gobject-Signals.html#g-signal-connect-object)

Try a simple g_signal_connect().

Regards,
                                                        Owen






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