Android Question Combobox - multiple columns

Ian Gordon-Brown

Member
Licensed User
Longtime User
Hello All

The B4XCombo box allows you to add a List to it via the SetItems method. Is there anyway we can modify the number of columns, to include hidden columns, which can be referenced later?

Thanks
Ian
 

Ian Gordon-Brown

Member
Licensed User
Longtime User
Hello Erel.

Thanks for prompt reply. Really appreciated.

What I did initially was add the ID on the end, separated by a '-' and then split the data after selection - I will look at the map item and see how it works.
It is a pity you can't retrieve a list (update maybe???).

Have a great day.
 
Upvote 0

udg

Expert
Licensed User
Longtime User
As @Erel suggested, you can set a map where the key is the label you pass to the standard ComboBox and the value is anything you want to associate with it.
Another approach is to design your own ComboBox class (CustomView). I did something similar in order to "hide" the need for an external (to the class) map.
In my case the "trick" was to set a new internal type and the corresponding internal list:
B4X:
Type dgCB_Item (cLabel As String, cValue As Object)
Private dgItems As List
Clearly "cLabel" is used for the standard Combobox/Spinner while cValue could be anything.
 
Upvote 0

Ian Gordon-Brown

Member
Licensed User
Longtime User
Thank you all.
Using the map object worked well.
Much appreciated
In VBA it would be called the scripting runtime
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…