[GtkMenu] Callback problem with popups submenus



Hi,

I have a problem with popup submenus callbacks. The following code display the 
popup, but the callback is not called:

-----
GtkWidget *menu, *submenu, *item;

menu = gtk_menu_new ();

item = gtk_menu_item_new_with_label ("Submenu 1");
gtk_container_add (GTK_CONTAINER (menu), item);

submenu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), submenu);

item = gtk_menu_item_new_with_label ("Item 1");
g_signal_connect (G_OBJECT (item), "activate", 
  G_CALLBACK (test_callback), NULL);
gtk_container_add (GTK_CONTAINER (submenu), item);

gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
  event->button, event->time);

gtk_widget_show_all (menu);
-----

- If I do not use submenu, all run as expected.

- When using submenu, if I use the "button_release_event" signal instead of 
"activate", it is more or less ok (callback is called), but the popup do not 
disappear anymore.

Does anybody see what's wrong here?

-> GNU/Linux with libgtk 2.6.8 on Debian/sid.

Thanks,

Bye



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