T tonadr New Member Nov 26, 2021 #1 How can I change a spinner item by item index (not selected item/index) Code: Copy MySpinner.Add("a") MySpinner.Add("b") MySpinner.Add("Z") MySpinner.Add("d") MySpinner.Add("e") MySpinner.Items(2)="c" '<--
How can I change a spinner item by item index (not selected item/index) Code: Copy MySpinner.Add("a") MySpinner.Add("b") MySpinner.Add("Z") MySpinner.Add("d") MySpinner.Add("e") MySpinner.Items(2)="c" '<--
epiCode Active Member Licensed User Nov 26, 2021 #2 If there is a lot of back and forth adding and deleting which will happen then you may use a List/KVS/Map to organize items and small routine to refresh those items in spinner. Upvote 0
If there is a lot of back and forth adding and deleting which will happen then you may use a List/KVS/Map to organize items and small routine to refresh those items in spinner.
M Mahares Expert Licensed User Longtime User Nov 26, 2021 #3 tonadr said: How can I change a spinner item by item index (not selected item/index) Click to expand... If you use B4XComboBox, not the conventional spinner (you need XUI Views Library) checked, you can have the items in a list and do something like this to replace an item with a new one: Code: Copy Dim lstItems As List lstItems.Initialize lstItems.AddAll(Array As String("a", "b", "z", "d", "e", "f")) lstItems.Set(2, "c") B4XComboBox1.cmbBox.Clear B4XComboBox1.SetItems(lstItems) 'the new list in the combo will be: a,b,c,d,e,f Added this 5 minutes later: You can probably use the conventional spinner also: Code: Copy sp.Clear sp.AddAll(lstItems) Last edited: Nov 26, 2021 Upvote 1
tonadr said: How can I change a spinner item by item index (not selected item/index) Click to expand... If you use B4XComboBox, not the conventional spinner (you need XUI Views Library) checked, you can have the items in a list and do something like this to replace an item with a new one: Code: Copy Dim lstItems As List lstItems.Initialize lstItems.AddAll(Array As String("a", "b", "z", "d", "e", "f")) lstItems.Set(2, "c") B4XComboBox1.cmbBox.Clear B4XComboBox1.SetItems(lstItems) 'the new list in the combo will be: a,b,c,d,e,f Added this 5 minutes later: You can probably use the conventional spinner also: Code: Copy sp.Clear sp.AddAll(lstItems)
josejad Expert Licensed User Longtime User Nov 26, 2021 #4 Code: Copy Spinner1.SelectedIndex = 2 TIP: You should use B4XComboBox from the XUI Views instead Spinner EDIT: ups, reading Mahare's answer, I've misunderstood your question Last edited: Nov 26, 2021 Upvote 0
Code: Copy Spinner1.SelectedIndex = 2 TIP: You should use B4XComboBox from the XUI Views instead Spinner EDIT: ups, reading Mahare's answer, I've misunderstood your question