Submenu inside popup menu problems



I've created popup menu with its submenu using code like below. Submenu is
displayed ok, but the problem is no
handler functions are called when submenu item gets clicked (all other popup
menu items work ok).

Can anyone spot the error ?

Thanks,
  Miroslav Rajcic


GtkWidget *menu, *submenu;
 GtkWidget *menu_item, *move_item;
 int button, event_time;

 menu = gtk_menu_new ();

 //add menu items
 menu_item = gtk_menu_item_new_with_label("Insert Node\tIns");
 g_signal_connect(GTK_OBJECT (menu_item), "activate", G_CALLBACK
(on_menu_insert_node), NULL);
 gtk_menu_append(menu, menu_item);
 gtk_widget_show (menu_item);  // Show the widget

 move_item = gtk_menu_item_new_with_label("Move Node");
 gtk_menu_append(menu, move_item);
 gtk_widget_show (move_item);  // Show the widget

 submenu = gtk_menu_new ();

 menu_item = gtk_menu_item_new_with_label("Up    \tShift+Up");
 gtk_menu_append(submenu, menu_item);
 g_signal_connect(GTK_OBJECT (menu_item), "activate", G_CALLBACK
(on_menu_move_up), NULL);
 gtk_widget_show (menu_item);  // Show the widget

 gtk_menu_item_set_submenu (GTK_MENU_ITEM (move_item), submenu);

 gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, button,
event_time);





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