Re: Menu Item problem



Dear All,

I have found the answer to my problem.

I have a sub-menu in which I have a couple of entries. I can check one of those, which disables the other one. In effect, I can use a check box or radio buttons to depict the change. I tried to check a menu item in the signal handler, but that caused a race condition, and the program crashed.

Now, I have used a signal handler of the parent to do this job. Bu parent I mean, the item which forks the sub-menu. It is working just fine.

Thanks
Kartikay



On Jan 29, 2008 5:53 PM, kartikay malhotra <kartikay malhotra gmail com> wrote:
Dear All,

I am back. This time I have a different problem. How do I disable a menu item from a pop-up menu?

When I create a menu, I use :

.
.
.
child = gtk_menu_item_new_with_label("XXX");
gtk_menu_insert(submenu, child, 1);
g_signal_connect(G_OBJECT(child), "activate", GTK_SIGNAL_FUNC(menu_callback), (gpointer)child);

menuAction = gtk_action_new("MenuAction", NULL, NULL, NULL);
gtk_action_connect_proxy(menuAction, child);
gtk_action_set_sensitive(GTK_ACTION(menuAction), FALSE);


I get a warning, Gtk-CRITICAL **: gtk_label_set_label: assertion `str != NULL' failed. However, the item gets disconnected (means it turns gray, non-selectable).

But when I use the same in menu_callback, no change occurs. What to do?

1. Do I use some other signal, instead of activate?


Many Thanks

--
Best Regards
Er. Kartikay Malhotra





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