[fxruby-users] radio buttons and data targets

Joel VanderWerf vjoel at PATH.Berkeley.EDU
Fri Jul 23 19:01:35 EDT 2004

I replied to this, but it went to the sender instead of to the group. 
(Did that change on fxruby-users when it moved to rubyforge?)

Yuri Leikind wrote:
> On Thu, 22 Jul 2004 07:46:22 -0500
> Lyle Johnson <lyle at knology.net> wrote:
>>     Now, if FXRuby's support for Ruby threads is disabled, FOX is greedy 
>>     and never lets any of the other threads run. So I'm a little suspicious 
>>     when you say that your client-server application's other threads are 
>>     able to run after you've called FXApp#disableThreads. Maybe something 
>>     has changed in Ruby's threads implementation recently?
> As for my application, calling  FXApp#disableThreads really doesn't allow my threads
> run, and I run Ruby 1.8.1 (standard Debian testing package).
> Anyway, as far as radiobuttons are concerned, FXDataTarget is way cool, but
> one can simply do something like this:
>             current_radiobutton.connect(SEL_COMMAND){
>                 all_radiobuttons.reject{|r| 
>                     r == current_radiobutton
>                 }.each {|r|
>                     r.checkState = false
>                 }
>             }
> and though it's not so nice as an FXDataTarget, it solves the problem in a threaded application.

One alternative which uses direct manipulation of state, as in the 
snippet above, but which has the elegance of FXDataTarget, is in my 
FoxTails lib:


Basically, you associate radio and check buttons (and other widgets) 
with ruby object attributes, and the values update as soon as the attrs 
are assigned to (and always reflect the state of the attrs).

See examples/simple.rb for some check and radio buttons.

I'm sorry to say, though, that the docs are weak on foxtails, and I 
haven't tried it with fox 1.2.

More information about the fxruby-users mailing list