Hi, I have a problem.
I need to show a list of radiobuttons. But if I just add them into a ScrollView only one radiobutton can be selected.
I need it like this
Do you have a symptom 1
Yes No
Do you have a symptom 2
Yes No
Do you have a symptom 3
Yes No
So I decided to add a pare of radio buttons into a panel and then add a panel with radio buttons inside into a scroll view.
The problem is that panel looks Ok with 2 radio buttons inside but 2 others are empty (at least they are look like this)
If I try to loop trough all views inside a scroll view I can see all my radio buttons but why they are not shown?
Here is my code and also I attached my project.
I need to show a list of radiobuttons. But if I just add them into a ScrollView only one radiobutton can be selected.
I need it like this
Do you have a symptom 1
Yes No
Do you have a symptom 2
Yes No
Do you have a symptom 3
Yes No
So I decided to add a pare of radio buttons into a panel and then add a panel with radio buttons inside into a scroll view.
The problem is that panel looks Ok with 2 radio buttons inside but 2 others are empty (at least they are look like this)
If I try to loop trough all views inside a scroll view I can see all my radio buttons but why they are not shown?
Here is my code and also I attached my project.
Radio buttons list:
#Region Project Attributes
#ApplicationLabel: Radio Buttons
#VersionCode: 1
#VersionName: 1
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private xui As XUI
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
Private svList As ScrollView
Private btnNext As Button
Private lblTitle As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Symptoms")
End Sub
Sub Activity_Resume
Try
CreateList
Catch
Log(LastException)
End Try
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Private Sub CreateList
Try
Dim j As Int
Dim ItemHeight As Int
Dim Qty As Int
Dim txt As String
Qty=3
ItemHeight=65dip
For i=1 To Qty
Dim cd As ColorDrawable
cd.Initialize2(Colors.white,5dip,2dip,Colors.Black)
j=j+1
txt="Radio " & i
Dim rbYes As RadioButton,rbNo As RadioButton
Dim pan As Panel
rbYes.Initialize("")
rbNo.Initialize("")
pan.Initialize("")
pan.Background=cd
rbYes.Text=txt & " " & "YES"
rbNo.Text=txt & " " & "NO"
rbYes.Tag=txt & " " & "YES"
rbNo.Tag=txt & " " & "NO"
rbYes.TextSize=14
rbNo.TextSize=14
rbYes.TextColor=Colors.Red
rbNo.TextColor=0xFF048904
rbYes.Enabled=True
rbNo.Enabled=True
pan.AddView(rbYes, 0, ItemHeight * (j-1), svList.Width/2.5, ItemHeight - 8dip)
pan.AddView(rbNo, svList.Width/2, ItemHeight * (j-1), svList.Width/2.5, ItemHeight - 8dip)
svList.Panel.AddView(pan,0,ItemHeight * (j-1), svList.Width, ItemHeight - 8dip)
Next
svList.Panel.Height= ItemHeight *j
Catch
Log(LastException)
End Try
End Sub
Sub btnNext_Click
Try
For Each v As View In svList.Panel.GetAllViewsRecursive
Log(v.Tag)
Next
Catch
Log(LastException)
End Try
End Sub