when I fill a B4XCombobox then I can not choose the first option. I first have to choose another option, and after that I can choose the first option.
How do I solve that?
I must be forgetting something, I think. As it looks like something is already chosen, but it is not.
it's filled like:
B4X:
ListOfAlbums.Initialize
If job.Success Then
Dim res As String
res = job.GetString
Log("Response from server albums: " & res)
Dim parser As JSONParser
parser.Initialize(res)
Dim items As List
items.Initialize
Dim list As List= res.As(JSON).ToList
For Each colroot As Map In list
items.Add(colroot.Get("albumname"))
Next
B4XComboBox1Albums.SetItems(items)
Else
Log("ERROR: " & job.ErrorMessage)
End If
Then it's picked like:
B4X:
Private Sub B4XComboBox1Albums_SelectedIndexChanged (Index As Int)
Dim albnme As String
albnme = B4XComboBox1Albums.cmbBox.GetItem(Index)
Log("albnme= " & albnme)
'''''do other stuff after selecting choice........
End Sub
Hi, I'm not totally sure, but I think the solution is in the B4XComboBox event.
Try commenting out line 145 of the B4XComboBox.bas class found inside the XUI Views library
B4XComboBox:
Private Sub RaiseEvent
Dim index As Int = getSelectedIndex
If LastSelectedIndex = index Then Return
If DelayBeforeChangeEvent > 0 Then
DelayIndex = DelayIndex + 1
Dim MyIndex As Int = DelayIndex
Sleep(DelayBeforeChangeEvent)
If MyIndex <> DelayIndex Then Return
End If
LastSelectedIndex = index
If xui.SubExists(mCallBack, mEventName & "_SelectedIndexChanged", 1) Then
CallSub2(mCallBack, mEventName & "_SelectedIndexChanged", index)
End If
End Sub
HI Mariano,
I tried what you suggested.
First I backed up the original XUI Views library.
Then I unzipped the library, then uncommented that line, then zipped it again. and renamed it as XUI Views.b4xlib.
It gives this error:
B4X:
B4A Version: 11.80
Parsing code. Error
Error parsing program.
Error description: Unknown type: bitmapcreator
Are you missing a library reference?
Error occurred on line: 57 (AnimatedCounter)
Dim bc As BitmapCreator
I tried it again and zipped it without compression, same error.
Your first option helps. Now the first option in the B4XComboBox is selectable right away.
(your 2nd option is something what I tried before but found it not user friendly enough, because it's always chosen at start and begins loading that data.)