Subject |
Re: radio button |
From |
Akshat Kapoor <akshat.kapoor@kapoorsons.in> |
Date |
Tue, 14 Jul 2020 11:18:10 +0530 |
Newsgroups |
dbase.getting-started |
Attachment(s) |
radio.wfm |
>
> 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.
Good Morning Mustansir,Heinz,
I tried to experiment with radiobuttons using the attached form.
I have been unable to prevent the double firing of onChange event but
have located the root cause.
Let's say there are 3 radiobuttons and first one is selected.
And user selects 2nd one The sequence of firing will be
radio1_onChange
radio2_onChange
So it is not a bug but WAD
May try later today for a solution
Regards
Akshat
| ** END HEADER -- do not remove this line
//
// Generated on 13-07-2020
//
parameter bModal
local f
f = new radioForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class radioForm of FORM
with (this)
onOpen = class::FORM_ONOPEN
height = 16.0
left = 46.2857
top = 0.0
width = 83.1429
text = ""
endwith
this.RADIOBUTTON1 = new RADIOBUTTON(this)
with (this.RADIOBUTTON1)
// onChange = class::RADIOBUTTON1_ONCHANGE
height = 1.0909
left = 13.0
top = 3.0
width = 15.7143
text = "Radiobutton1"
group = true
endwith
this.RADIOBUTTON2 = new RADIOBUTTON(this)
with (this.RADIOBUTTON2)
// onChange = class::RADIOBUTTON2_ONCHANGE
height = 1.0909
left = 13.4286
top = 4.9545
width = 15.7143
text = "Radiobutton2"
endwith
this.RADIOBUTTON3 = new RADIOBUTTON(this)
with (this.RADIOBUTTON3)
// onChange = class::RADIOBUTTON3_ONCHANGE
height = 1.0909
left = 13.8571
top = 6.9091
width = 15.7143
text = "Radiobutton3"
value = true
endwith
function RADIOBUTTON1_onChange()
form.radiobutton1.onchange = null
form.radiobutton2.onchange = null
form.radiobutton3.onchange = null
?[radio button 1 on change]
// if msgbox("Do you want to change the values","Alert",4) = 6
form.radio = 1
// else
// do case
// case form.radio = 1
// form.radiobutton1.value = true
// case form.radio = 2
// form.radiobutton2.value = true
// case form.radio = 3
// form.radiobutton3.value = true
// endcase
// endif
form.reset()
return
function RADIOBUTTON2_onChange()
form.radiobutton1.onchange = null
form.radiobutton2.onchange = null
form.radiobutton3.onchange = null
?[radio button 2 on change]
// if msgbox("Do you want to change the values","Alert",4) = 6
form.radio = 2
// else
// do case
// case form.radio = 1
// form.radiobutton1.value = true
// case form.radio = 2
// form.radiobutton2.value = true
// case form.radio = 3
// form.radiobutton3.value = true
// endcase
// endif
form.reset()
return
function RADIOBUTTON3_onChange()
form.radiobutton1.onchange = null
form.radiobutton2.onchange = null
form.radiobutton3.onchange = null
?[radio button 3 on change]
// if msgbox("Do you want to change the values","Alert",4) = 6
form.radio = 3
// else
// do case
// case form.radio = 1
// form.radiobutton1.value = true
// case form.radio = 2
// form.radiobutton2.value = true
// case form.radio = 3
// form.radiobutton3.value = true
// endcase
// endif
form.reset()
return
function form_onOpen()
form.radio = 1
form.radiobutton1.value = true
form.reset()
return
function reset()
form.radiobutton1.onchange = form.radiobutton1_onchange
form.radiobutton2.onchange = form.radiobutton2_onchange
form.radiobutton3.onchange = form.radiobutton3_onchange
return
endclass
|
|