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? -- R. Mark Volkmann Object Computing, Inc.
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. best wishes, -- henon
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? -- R. Mark Volkmann Object Computing, Inc.
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
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: > > 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="When I do that I get "wrong argument type Fixnum (expected Data). I have no idea what a Data object is.> 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.No problem. I''m glad for any response. -- R. Mark Volkmann Object Computing, Inc.
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: > > > 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=" > > When I do that I get "wrong argument type Fixnum (expected Data). I > have no idea what a Data object is.Fixnum? so you have tried to pass an index. but the doc says you can pass the option itself or nil. Data stands for a wrapped C object i think which means a fox widget. -- henon
Meinrad Recheis wrote:> 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: >>> >>>> 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=" >>> >> When I do that I get "wrong argument type Fixnum (expected Data). I >> have no idea what a Data object is. >> > > Fixnum? so you have tried to pass an index. but the doc says you can > pass the option itself or nil. Data stands for a wrapped C object i > think which means a fox widget. > > -- henon > > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > >Hi guys, It''s been my experience that when "Data" starts popping up in FXRuby stuff, it''s time to go to the API Docs. Try the FXOptionMenu page[1]. I usually start around the attributes section. I think you''ll find that the FXOptionMenu contains a list of FXOptions. You can get at them through either index ((get/set)CurrentNo) which takes a Fixnum or reference ((get/set)Current) which deals in FXOptions. Or that''s the way it looks to me, anyway. I''ve not used the FXOptionMenu myself. I hope that helps. Matthew J Desmarais [1] http://fxruby.org/doc/api/classes/Fox/FXOptionMenu.html#M002096
On Wednesday 29 March 2006 13:47, Mark Volkmann 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?My recommendation is to call setCurrentNo() which simply takes the index; the other takes a pointer to FXOption which is often not as convenient! - Jeroen -- +----------------------------------------------------------------------------+ | Copyright (C) 19:40 03/30/2006 Jeroen van der Zijp. All Rights Reserved. | +----------------------------------------------------------------------------+ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20060330/12e2f5be/attachment.bin