[fxruby-users] RadioButtons not working right in FxRuby 1.2.2?
Joel VanderWerf
vjoel at PATH.Berkeley.EDU
Tue Jan 4 18:56:08 EST 2005
DeZonia, Barry wrote:
> When I run my own app, as well as button.rb from the examples subdirectory,
> the RadioButtons within a GroupBox are not deselecting the previous choice
> and once toggled on will not toggle off. Is anyone else seeing this?
>
> I'm using FxRuby 1.2.2 that shipped with the one click Windows installer
> Ruby 1.8.2 final.
You can use data targets, since GroupBox no longer imposes this
functionality.
Advertisement:
You can also use FoxTails (on RAA), which has its own targeting
mechansim that you may feel is more ruby-like.
The current version of FoxTails has a "field" construct, a new layer on
top of the targeting mechanism, which makes this even simpler, almost
like scanf:
class FieldsWindow < FXMainWindow
include FTField
observable :my_radio
def initialize(*args)
# ...
self.my_radio = 2
field("%r radio one %r radio two %r radio three",
[:my_radio, 1], [:my_radio, 2], [:my_radio, 3])
That's all it takes to have three radio buttons on a line, all tied into
the same variable, my_radio, which takes the values 1,2 and 3 depending
on the button pressed. The fields don't have be on the same line, and
there are other options like %v for a checkbox, %f (and %6.2f etc) for
float, %m for a pop-up option menu to select from an array of objects,
%s for string, %d for int, etc. Since the variable is "observable", you
can attach blocks of code ("observers") that are triggered when its
value changes, so you can keep other controls and views consistent. The
field string can also include a %| specifier to make things line up
inside a FXMatrix. You can also attach blocks of code for input
validation. See examples/fields.rb for, well, examples.
The catch? FoxTails was designed for Fox 1.0, though I am using it with
1.2 by defining some extra methods that convert argument lists, define
aliases, and so on--just enough of a 1.0/1.2 compatibility layer to make
FoxTails work. I can send that "dynamic patch" file to anyone who is
interested. The next release will either include the patch (to support
both 1.0 and 1.2) or support only 1.2.
More information about the fxruby-users
mailing list