Re: how to get the text(label) of the Menu item widget??



On Sat, 2006-12-02 at 11:23 +0530, Naveen Kumar wrote:
> Hi All,
> i am using option menu in my application. Problem is i am unable to fetch
> the Text(label) of the Menu item when it is selected.
> 
> Based on the text collected(label) from the menu item, i need to update a
> entry and a label in some other window.
> how do i do it? 

In the "changed" signal handler for the GtkOptionMenu you get a pointer
to the GtkOptionMenu itself. Using it, you can call
gtk_option_menu_get_history to get the index of the currently selected
item. You can store the strings of the menu items in an array and pick
the correct one using that index. 

You could consider using GtkComboBox --- GtkOptionMenu is a deprecated
widget...

Hope this helps,

-- m



-- 
Mariano Su�z-Alvarez
http://www.gnome.org/~mariano





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