David Hawkins Active Member Licensed User Longtime User Jan 3, 2019 #1 Is there a way for a spinner to work similar to a .NET ComboBox works? B4X: With ComboBox1 .DataSource = Nothing .DataSource = dt .DisplayMember = "company" .ValueMember = "companyid" .SelectedIndex = -1 End With I need to be able to select the underlying 'companyid' from the selected dropdown item.
Is there a way for a spinner to work similar to a .NET ComboBox works? B4X: With ComboBox1 .DataSource = Nothing .DataSource = dt .DisplayMember = "company" .ValueMember = "companyid" .SelectedIndex = -1 End With I need to be able to select the underlying 'companyid' from the selected dropdown item.
Erel B4X founder Staff member Licensed User Longtime User Jan 3, 2019 #2 The spinner stores the items text representation. You can use a Map that maps between the items text and the items themselves. Upvote 0
The spinner stores the items text representation. You can use a Map that maps between the items text and the items themselves.
David Hawkins Active Member Licensed User Longtime User Jan 3, 2019 #3 I think I know what you mean. So create a map with 'company' and 'companyid' and use the 'Position' in the Spinner Item_Click event to select the map index to return what I want, does that sound right? Upvote 0
I think I know what you mean. So create a map with 'company' and 'companyid' and use the 'Position' in the Spinner Item_Click event to select the map index to return what I want, does that sound right?
Erel B4X founder Staff member Licensed User Longtime User Jan 3, 2019 #4 More or less. It is not the index, but rather the name which is the key. You can use a List instead of a Map and then get the item based on the index. Upvote 0
More or less. It is not the index, but rather the name which is the key. You can use a List instead of a Map and then get the item based on the index.
David Hawkins Active Member Licensed User Longtime User Jan 3, 2019 #5 This I can work with, thank you Erel. Upvote 0