B4J Question [BANanoVuetifyAD3] Error on VComboBox

Star-Dust

Expert
Licensed User
Longtime User
I have inserted a VComboBox that contains 5 items and each item has its own numeric value
B4X:
VComboBox1.AddItem(1,"One")
VComboBox1.AddItem(2,"two")
VComboBox1.AddItem(3,"three")
VComboBox1.AddItem(4,"four")
VComboBox1.AddItem(5,"five")
1643975955883.png


When I select an item, correctly in the Change event it returns me the value.
But the item does not appear in the view but the value which is an index while the selected item should appear.
1643975920796.png


Why does it happen, is it a bug?


I have attached an example that reproduces the error
 

Attachments

  • VComboBoxError.zip
    15.3 KB · Views: 94

Star-Dust

Expert
Licensed User
Longtime User
Hi, thanks for the report. I've just confirmed if the kitchen sink examples are working...

View attachment 125107

Will investigate your code and if its a bug, will be fixed. ;)

#BugFinderComingThrough ?
In the kitchen it works because both the Text and the value match with the same string.

But if you put an entry in the text and an index in the value, the problem arises.
 
Upvote 0

Mashiane

Expert
Licensed User
Longtime User
Eureka!

VComboBox.gif


Updated your code to be in line with the kitchen sink examples. You accidentally left out .Clear and .Refresh.

B4X:
VComboBox1.Clear(page)
    VComboBox1.AddItem(1,"One")
    VComboBox1.AddItem(2,"two")
    VComboBox1.AddItem(3,"three")
    VComboBox1.AddItem(4,"four")
    VComboBox1.AddItem(5,"five")
    VComboBox1.Refresh(page)

All the best.

PS: I will include your example in the kitchen sink, just for more examples to be available. Thx.
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
I think I have explained myself badly.

The operation I see in your image is what I already get with my example. But this is not the normal behavior.

When I select ONE on the Combo text bar you find "1" but I should find ONE
 
Upvote 0

Mashiane

Expert
Licensed User
Longtime User
Just to add, a VCombo has an editable feature, meaning that you can add items to it by typing content on the combo and pressing enter.
Perhaps they did it this way because there is no way to determine what you are entering is a value / text.

If your users will not be adding any item to your combo, use other alternatives or use the same text for values.
 
Upvote 0
Top