I have a set of RadioButtons in an array in a CustomDialog2 and wish to set one of them checked.
I do so outside the array loop but it fires the CheckedChange every time the dialog is opened.
I don't want anything to happen until I select one or cancel and do nothing, howver by then it is too late.
Is there a solution please?
I do so outside the array loop but it fires the CheckedChange every time the dialog is opened.
I don't want anything to happen until I select one or cancel and do nothing, howver by then it is too late.
Is there a solution please?
B4X:
Sub Options
Dim dOptions As CustomDialog2
Dim dPnl As Panel
Dim arb(5) As RadioButton
Dim lbl(5) As Label
Dim i As Byte
Dim txt As String
dPnl.Initialize("dPnl")
Dim dBgnd As ColorDrawable
dBgnd.Initialize(Colors.Gray, 5dip)
dPnl.Background = dBgnd
For i=0 To 4
txt=i+6
lbl(i).Initialize("")
lbl(i).Gravity=Gravity.CENTER
lbl(i).Text=txt
arb(i).Initialize("rb")
arb(i).Text=txt
dPnl.AddView(lbl(i),i*60dip+90dip,10dip,35dip,35dip)
dPnl.AddView(arb(i),i*60dip+90dip,50dip,35dip,35dip)
Next
arb(usedPics-6).checked=True 'This fires when opened
dOptions.AddView(dPnl, 60%x, 25%y)
ret = dOptions.Show("Number of Pictures", "OK", "Cancel", "", Null)
End Sub
Sub rb_CheckedChange(checked As Boolean)
Dim snd As RadioButton
snd=Sender
usedPics=snd.Text
NewDisplay
End Sub