refresh item list in spinner

Fabrice La

Active Member
Licensed User
Longtime User
Hi
I have a spinner with Items (recorded in file). One of the Item is "add Item", this give the possibility to add an item by the user.

When the item is created and added to the file list, I can't see the new item in the spinner. I have to close the activity and reopen it.

How to refresh the spinner item list in the activity ?
 

Fabrice La

Active Member
Licensed User
Longtime User
when the activity is focused the spinner is filled with a list from file using:

cbItem.Initialize("cbItem")
cbItem.TextSize=20
Dim TRA As TextReader
TRA.Initialize(File.OpenInput(File.DirDefaultExternal,"Choix.ndf"))
Dim line As List
line = TRA.ReadList
Log("Combo lignes ; " & line)
TRA.Close
cbItem.Clear
For i = 0 To line.Size - 1
cbItem.Add(Main.trans.GetText(line.Get(i)))
Next
'cbItem.Invalidate
cbItem.Prompt=Main.trans.GetText("Choisir")

the user can choose "add Item" from the spinner to add new item. this item is added to the file and do again

cbItem.Initialize("cbItem")
cbItem.TextSize=20
Dim TRA As TextReader
TRA.Initialize(File.OpenInput(File.DirDefaultExternal,"Choix.ndf"))
Dim line As List
line = TRA.ReadList
Log("Combo lignes ; " & line)
TRA.Close
cbItem.Clear
For i = 0 To line.Size - 1
cbItem.Add(Main.trans.GetText(line.Get(i)))
Next
'cbItem.Invalidate
cbItem.Prompt=Main.trans.GetText("Choisir")

But the spinner list is not refresh. I have to close activity and go back to the activity to refresh the list.

How to refresh the spinner list without to close activity ?
 
Upvote 0
Top