[fxruby-users] FXOptionMenu setCurrent method

Meinrad Recheis meinrad.recheis at gmail.com
Wed Mar 29 15:24:35 EST 2006

On 3/29/06, Mark Volkmann <r.mark.volkmann at gmail.com> wrote:
> On 3/29/06, Meinrad Recheis <meinrad.recheis at gmail.com> wrote:
> > On 3/29/06, Mark Volkmann <r.mark.volkmann at gmail.com> wrote:
> > > I've got a FXOptionMenu that is associated with an FXPopup that has
> > > several FXOptions.
> > > At some point after creating this, I'd like to set the current value
> > > of the option menu. I see that FXOptionMenu has a setCurrent method,
> > > but it's not clear to me what I'm suppose to pass to that. Does anyone
> > > know how to use that method or if that's the normal way to set the
> > > value of an option menu?
> >
> > several widgets have this method "setCurrent". it always takes an
> > index to the element that shall become the current one.
> Thanks!  What if I don't know the index, but I know the string value.
> Is there a way I can loop though the values in an option menu and
> determine the index of the one I want to select?
have you tried it? i think i was wrong. FXOptionMenu#current is
documented like this:
current  	 [RW]   	The current option, or nil if none [FXOption]

which means you can set the option you want directly by passing it to "current="

anyways, if you want to iterate over all options there is a method
FXOptionMenu#children returning an array of options.
sorry for the erratic response of mine.
-- henon

More information about the fxruby-users mailing list