Re: get menu items



Jacob Perkins wrote:

I can't seem to find a method of iterating through a menu to check the
state of each menu item. Specifically, I have an option_menu that
contains check_menu_items, and I want to access each item to see if it
is activated or not.  This is in gtk-2.

Hello, Jacob

Looks like you want to use "children" field of "GtkMenuShell" widget class. Its of
"GList*" type. One of the way to do this is:
---
static void interate(GtkOptionMenu *omenu)
{
GList          *node;
GtkWidget *menu;

/* all g_return_if_fail checks skipped */

   menu = gtk_option_menu_get_menu(omenu);
   node = GTK_MENU_SHELL(menu)->children;
   for (;node;node=node->next) {
       /* go throug list and do whatever you like with node->data */
   }
}
---

Olexiy






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