A Spinner is loaded based on the condition, this Spinner shows the values loaded in it correctly and when selected from the dropdown, the Position and Value also work.
But in the Spinner the SelectedItem is not seen, it remains blank.
B4A
You are right,
I had the same doubt and did change the color to Colors.White two days back, but its the same problem, as Erel sir has suggested I will drop the screenshots.
Try
Dim pnl As B4XView = xui.CreatePanel("")
Dim lbl As Label
wv.Initialize("")
lbl.Initialize("")
chkSngl_Dbl.Initialize("chkSngl_Dbl")
spnB.Initialize("spnB")
spnB.TextColor = Colors.White
spnC.Initialize("spnC")
spnC.TextColor = Colors.White
spnV.Initialize("spnV")
spnV.TextColor = Colors.White
SQL_Util.LoadSpinner("SELECT * FROM Books WHERE BookID>=1 AND BookID<=66", spnB, Starter.SQL_Books,1) 'Works properly, no issues here
Spinner is blank:
Sub spnB_ItemClick (Position As Int, Value As Object)
spnC.Enabled = True
BkID = Starter.SQL_Books.ExecQuerySingleResult("SELECT BookID FROM Books WHERE BookName LIKE '" & Value & "' ")
A = Starter.SQL_Books.ExecQuerySingleResult("SELECT Bk_Acro FROM Books WHERE BookName LIKE '" & Value & "' ")
Dim limit As Int = 50
spnC.Clear
'Load the Spinner with values
For i=1 To limit
spnC.Add(i)
Next
spnC.SelectedIndex = 0
The above Spinner spnC is loaded with values 1 to 50, after selection, Spinner display is blank.
The problem is that you are trying to populate the Spinner by his ItemClick Event.
Initially the Spinner is without any items.............. so there is nothing to Click and the ItemClick Event will never be raised.
You need to populate the Spinner somewhere else in your code (for example after loading the Layout) and then you will be able to do everything.
Example
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
For x = 0 To 49
Spinner1.Add(x)
Next
Spinner1.SelectedIndex = 0
End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
Private Sub Spinner1_ItemClick (Position As Int, Value As Object)
'Do what you need with the selected item here................
End Sub