Re: [Fxruby-users] FXSlider & FXDail
Status: Inactive
Brought to you by:
lyle
From: meinrad r. <mei...@gm...> - 2003-10-06 09:07:24
|
Robert McGovern wrote: > Hi there, > > Came across my first frustration today, I need to be able to increment by 0.1 > and neither FXSlider nor FXDail support that. I know I can get around this by > rescaling the values being used but from my users point of view I unfortuatly > need a "cleaner" solution. > > I assume this is a problem with Fox itself rather than FXRuby? If so I wonder > if Joeren (?) is open to petition on this. > > Rob > hi, hey! you are using ruby. you can adopt nearly everything to your needs. you could subclass FXSlider and overwrite the methods so that they accept and return float values. something like this should work (note: untestet code without any errorchecking i.e. div by zero, @float_increment.nil? ...) class Slider < FXSlider def increment= increment super(1) @float_increment=increment end def increment @float_increment end alias :old_value= :value= alias :old_value :value def value= set_value old_value=(set_value/@float_increment).to_i end def value oldvalue*@float_increment end end #class others please correct me if i am wrong. hope this helps, - henon -------------- % cat "food in cans" cat: can't open food in cans |