If I change a spinner's textcolor during runtime, the displayed text color doesn't change until the user selects a new item.
I've tried disabling and re-enabling to see if that refreshes the view, but it does not. What else could I try?
Nope, didn't work. I've also now tried invalidating the spinner after changing the color - and somehow, that doesn't work either. Even changing the selected index to something else and then back again doesn't fix it - only if the USER forces it to a different item does it refresh.Try putting a DoEvents in right after the line where you change the color.
--- Jem
You will need to recreate the spinner if you change the color.
Spinner (like ListView) reuses the views when it shows items. So instead of creating a view for each item it only creates a view for each visible item and then reuses these views.
Changing the text color at runtime will not change the text color of existing views. So you will need to recreate the spinner. Note that it should be a very quick operation to rebuild the spinner.
Spinner (like ListView) reuses the views when it shows items. So instead of creating a view for each item it only creates a view for each visible item and then reuses these views.
Changing the text color at runtime will not change the text color of existing views. So you will need to recreate the spinner. Note that it should be a very quick operation to rebuild the spinner.
The issue at this point isn't removing the view, it's adding it. AHViewPager uses panels to display views, and moves the panels. However, while you can use AHViewContainer.GetPageObject to reference the panel, you cannot perform an operation FROM that panel (AddView) using that method.I'm not really familiar with AHViewPager however creating a new view is usually quite simple. You just need to call Spinner1.RemoveView to remove the view from its parent. Create the new view and add it to its parent.
You should recreate the spinner.
Recording the current position, clearing all items, and then re-adding those items and setting the position back does refresh the spinner without respawning it.
Sub refreshSpinner(spin As Spinner)
Dim arraytemp(spin.Size) As String, selectedIndex As Int
For x=0 To spin.Size-1
arraytemp(x)=spin.GetItem(x)
Next
selectedIndex=spin.selectedIndex
spin.Clear
For x = 0 To arraytemp.Length-1
spin.Add(arraytemp(x))
Next
spin.selectedIndex=selectedIndex
End Sub