Forum: Ruby How to disable the default selection of a radio button?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Li C. (Guest)
on 2009-01-10 22:52
Hi all,

I use FXRuby to create  5 radio buttons and tie them to FXDataTarget.
When I run the codes a defautl button is always selected. Is it
possible to disable this feature so that no button is chosen at the
first run?

Thanks,

Li
Lyle J. (Guest)
on 2009-01-12 17:48
(Received via mailing list)
On Sat, Jan 10, 2009 at 2:51 PM, Li Chen <removed_email_address@domain.invalid> 
wrote:

> I use FXRuby to create  5 radio buttons and tie them to FXDataTarget.
> When I run the codes a defautl button is always selected. Is it
> possible to disable this feature so that no button is chosen at the
> first run?

Sure, just initialize the FXDataTarget to some value that doesn't
correspond to *any* of the radio buttons, e.g.

    data_target = FXDataTarget.new(-1)
    FXRadioButton.new(..., :target => data_target, :selector =>
FXDataTarget::ID_OPTION+0, ...)
    FXRadioButton.new(..., :target => data_target, :selector =>
FXDataTarget::ID_OPTION+1, ...)
    FXRadioButton.new(..., :target => data_target, :selector =>
FXDataTarget::ID_OPTION+2, ...)
    FXRadioButton.new(..., :target => data_target, :selector =>
FXDataTarget::ID_OPTION+3, ...)
    FXRadioButton.new(..., :target => data_target, :selector =>
FXDataTarget::ID_OPTION+4, ...)

Hope this helps,

Lyle
Li C. (Guest)
on 2009-01-13 01:10
Lyle J. wrote:

>
> Sure, just initialize the FXDataTarget to some value that doesn't
> correspond to *any* of the radio buttons, e.g.

Thanks. But where can I find this tip in its API?

Li
This topic is locked and can not be replied to.