Re: [gtk-list] Re: Use of optionmenu's



On a related note, I have an option menu in a dynamic window (can pop up any
number of these windows).  How can I tell which window's menu was selected?  If
I have to do the global variable thing as illustrated below, I'll implement
something else.

Lee wrote:

> Aslak Johansen wrote:
>
> > I am trying to figure out how to see which option is selected
> > in an gtk_option_menu.
> > There must be a simple way to do so!
>
> I had the same thought exactly last week. The best way I've found to handle
> the problem (and it's more of a gross hack than a solution), is to connect a
> function to the "activate" signal of each item of the option menu.
> Make that function then set a global variable to a value that you as the
> programmer know represents one of the items in your option menu.
> When you need to know what has been selected, just examine your global
> variable.
>
> It's dirty, it's global, and it's down-right unpleasant, imho.
> But it does work.
>
> You can retrieve the selected "menuitem" itself using
> gtk_menu_get_selected() (or a similar named function, i don't have the
> reference docs to hand).
> But how you extract the actual name of the item from what is returned, I
> don't know.
>
> As a plea to the gtk+ developers, please consider making a nicer option menu
> API in the next major version of gtk+... Please?
>
> Regards,
>
> Lee.
>
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null

--
-------------------------------------------------------------------------
Ray Clouse                         |             Don't fear the penguins.
Engineer Scientist/Specialist      |
Boeing Expendable Launch Vehicles  |  Ray.Clouse AT boeing.com
Huntington Beach, CA               |  rclouse AT penguinpowered.com





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