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.
73700e119917433681f2e8f3e4369f74?d=identicon&s=25 Li CN (alex-osu3)
on 2009-01-10 21: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
28f5a897a255c1d9780ad525f0b934a9?d=identicon&s=25 Lyle Johnson (Guest)
on 2009-01-12 16:48
(Received via mailing list)
On Sat, Jan 10, 2009 at 2:51 PM, Li Chen <chen_li3@yahoo.com> 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
73700e119917433681f2e8f3e4369f74?d=identicon&s=25 Li CN (alex-osu3)
on 2009-01-13 00:10
Lyle Johnson 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.