Re: Getting value from an option menu



Dean Schumacher wrote:

Hello. I'm just starting to learn GTK+ programming and am having
trouble figuring out how to get the value the user has selected
on an option menu.

Looking in the online GTK+ Reference Manual, there doesn't seem
to be any function to get the value.

A GtkOptionMenu is like any other menu - you connect callbacks to the "activate" signals on the individual items.


Also, I'm thinking, surely there's an easier way of doing
this. For a GtkEntry object, it just takes a single call
to gtk_entry_get_text. Is there not something similar to get
the value from an option menu? I can't find it in any
documentation.


For this behaviour, what you want is a GtkComboBox - it's basically a GtkEntry, with a list of predefined text values that the user can select.

Regards,
Timothy M. Shead
tshead k-3d com





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