B4J Question ComboBox - bug causing label node text to be invisible

Jimdriver2

Member
Licensed User
Longtime User
I'm using B4J for the first time to create a program to compliment a B4J app.

I'm populating a ComboBox with a list of Labels so I can use the labels to display & store a Lookup value & key pair using the text and tag. It works fine but for some reason once you've selected an item from the list once it becomes 'invisible' on the drop down, despite being there and still being shown as the selection if chosen. Eventually you end up with an entire list of 'blank' items, although it still works.

It's something to do with putting Labels in as the items. If I just manually put a ComboBox on my form and manually add strings it works fine. Sometimes the ComboBox items reappear as something forces the comboBox to redraw the items. My guess is my Label that I'm creating in code is missing some important property, but I'm not sure what

Here's my code:
B4X:
    StaffComboBox.Items.Clear
    
    Dim LookupRS As ResultSet
    LookupRS = MainDB.ExecQuery("SELECT StaffName, StaffID FROM Staff ORDER BY StaffName ASC")
    
    Do While LookupRS.NextRow
        
        Dim NewDataLabel As Label
        NewDataLabel.Initialize("")
        NewDataLabel.Text = LookupRS.GetString("StaffName")
        NewDataLabel.Tag = LookupRS.GetInt("StaffID")
        
        StaffComboBox.Items.Add( NewDataLabel )
        
    Loop
 

Jimdriver2

Member
Licensed User
Longtime User
Couldn't get anywhere with this. I think it's something to do with the label text colour being changed once it's been selected. It appears as White if it's the selected item.

I just had to resort to going make to using a matching Map data structure, as per spinners in B4A.
 
Upvote 0
Top