Hi, at the moment I only have two Radiobuttons on a single panel.
After selecting one, I save the index value to my database.
If I restart and select an option to return to defaults, this means I have to check the first one and uncheck the second one. The result is they both end up checked which I thought shouldn't happen?
Any ideas?
Malky
After selecting one, I save the index value to my database.
If I restart and select an option to return to defaults, this means I have to check the first one and uncheck the second one. The result is they both end up checked which I thought shouldn't happen?
B4X:
Sub CreateSettingsPanel
Price = SQL1.ExecQuerySingleResult("SELECT value FROM system where var = 'price'")
prop_type = SQL1.ExecQuerySingleResult("SELECT value FROM system where var = 'prop_type'")
Dim HeightTop
Activity.AddView(pnlSettings, 0, 0, 100%x, 100%y)
Dim sqlRowCount As Int
Dim Cursor1 As Cursor
Cursor1 = SQL1.ExecQuery("SELECT id, " & language & ", prop_type FROM settings order by prop_type")
Log("count = " & Cursor1.RowCount)
sqlRowCount= Cursor1.RowCount
Dim btndefaultsettings, btnSaveSettings,btnCancelSettings As Button
Dim radButtons(sqlRowCount) As RadioButton
btndefaultsettings.Initialize("btnDefaultSettings")
btnSaveSettings.Initialize("btnSaveSettings")
btnCancelSettings.Initialize("btnCancelSettings")
edtPrice.Initialize("edtPrice")
edtPrice.Hint = DictionList(5)
edtPrice.InputType =edtPrice.INPUT_TYPE_NUMBERS
edtPrice.ForceDoneButton = True
edtPrice.HintColor = Colors.gray
HeightTop = 50dip
pnlSettings.AddView(btndefaultsettings, 0dip, 0dip, 100%x, HeightTop) 'Height 50
Log("Settings count = " & sqlRowCount)
For i = 0 To sqlRowCount - 1
Cursor1.Position = i
Dim Rad As RadioButton
Rad.Initialize("RadButton")
Rad.Text = Cursor1.getstring(language)
Rad.Tag = Cursor1.GetString("prop_type")
If i = prop_type Then
Log("Rad true = " & i)
Rad.Checked = True
'DoEvents
Else
Log("Rad false = " & i)
Rad.Checked = False
End If
radButtons(i) = Rad
pnlSettings.AddView(Rad,5dip, HeightTop + 5, pnlSettings.Width, 50dip)
HeightTop = HeightTop + 55dip
Next
If Price = 1000000 OR Price =0 Then
edtPrice.Text = ""
Else
edtPrice.Text = Price
End If
pnlSettings.AddView(edtPrice, 0dip, HeightTop + 5dip, 48%x, 50dip) 'Height 50
HeightTop = HeightTop + 55dip
pnlSettings.AddView(btnSaveSettings, 0dip, HeightTop + 5dip, 48%x, 50dip) 'Height 50
pnlSettings.AddView(btnCancelSettings, 49%x, HeightTop + 5dip, 48%x, 50dip) 'Height 50
btnCancelSettings.Text = DictionList(20)
btnSaveSettings.Text = DictionList(19)
btndefaultsettings.Text = DictionList(4)
'pnlSettings.Visible = True
End Sub
Any ideas?
Malky