Android Question B4XComboBox: How to enter text instead of selecting an item from the list

toby

Well-Known Member
Licensed User
Longtime User
I thought one of the differences between B4XComboBox and Spinner is that B4XComboBox allows user to enter text if an item is not on the list. With the attached test app, I couldn't enter any text and there is no TextChanged event exposed. Can someone help me out, please?

I'm not sure that this is a feature already supported, as a result I created a related wish post which I couldn't delete, by the way.
 

Attachments

  • b4xcomboBox.zip
    9.3 KB · Views: 113

Mahares

Expert
Licensed User
Longtime User
I'm not sure that this is a feature already supported
Here is a way to do it, but I am not sure if it is a good way to do it. I think you have something else in mind,:
B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")
    lstItems.Initialize2(Array As Int(1,2,3,4,5))
    B4XComboBox1.SetItems(lstItems)
    For Each n As Int In lstItems
        Log(n)
    Next
End Sub

Sub Button1_Click
    Dim l2 As List
    l2.Initialize
    l2.AddAll(lstItems)
    l2.Add(17)
    B4XComboBox1.cmbBox.Clear
    B4XComboBox1.SetItems(l2)    
    For Each n As Int In l2
        Log(n)
    Next
End Sub
 
Upvote 0
Top