Subject Re: radio button
From Heinz Kesting <Nobody@Nowhere.com>
Date Mon, 13 Jul 2020 17:52:04 +0200
Newsgroups dbase.getting-started

Hi Mustansir,

>
> Even I thought of changing object with the condition that I wish to have.
>

Not sure if this is going to help with your specific scenario, but the
following works nicely for me:

First, try to avoid thwe OnGotFocus event and use OnChange instead.

Then, for all radiobuttons of a group, use just one common function for
the OnChange event. If the user is making a choice, this common event
will fire at least twice, but that doesn't matter.

this.RBTN1 = new RADIOBUTTON(this)
    with (this.RBTN1)
       onChange = class::RBTNS_ONCHANGE

this.RBTN2 = new RADIOBUTTON(this)
    with (this.RBTN2)
       onChange = class::RBTNS_ONCHANGE

this.RBTN3 = new RADIOBUTTON(this)
    with (this.RBTN3)
       onChange = class::RBTNS_ONCHANGE

You get the idea ...

In the function I check for the radiobutton which has been set to TRUE, like

function RBTNS_OnChange
if form.rbtn1.value = true
    // stuff for radiobutton 1
elseif form.rbtn2.value = true
    // stuff for radiobutton 2
elseif form.rbtn3.value = true
    // stuff for radiobutton 3
endif
return

This way it's quite easy to fire just the code you need for this exact
situation and you can stick to radiobuttons, which is the expected type
of control for such a scenario.

Hope I could give you something to play with ...
Kind regards, Heinz