Re: dynamic menus



David Necas (Yeti) schrieb:

[...]

First, you know the index. The entries are simply
sequentially numbered from 0, so if you constructed them
you also know the index.
Well, yes ... that's what I meant ... I don't know it because I didn't store it ;)

Then, there's sometimes the possbility you don't have the
original map from/to indices available any more. You can
obtain the list of items:

   GtkWidget *menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(option_menu));
   GList     *list = GTK_MENU_SHELL(menu)->children;

and scan the list. It's usually a better idea to identifiy
the items explicitely with some g_object_set_[q]data(...) at
the time of construction and checking these instead of the
labels.
Thanks for those hints. I'll try that path.

Karl.



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