M mohammad3250 New Member Mar 19, 2020 #1 Hi I want to store some non-duplicate information in the list but unfortunately it can get in the way of tips?
Hi I want to store some non-duplicate information in the list but unfortunately it can get in the way of tips?
DonManfred Expert Licensed User Longtime User Mar 19, 2020 #2 Should we guess what you have tried and how? Show us your not working code. Best is to upload a small project which shows the Issue. Use File->Export as zip from the IDE Upvote 0
Should we guess what you have tried and how? Show us your not working code. Best is to upload a small project which shows the Issue. Use File->Export as zip from the IDE
M mohammad3250 New Member Mar 19, 2020 #3 B4X: Sub check (position As Int) As Boolean For i=0 To lanswer.Size-1 If lanswer.Get(i)=position Then Return True End If Next End Sub B4X: If check(position)=False Then lanswer.Add(position) End If I used a multi-panel and the value of each panel I want to save to when the user clicks again to see if they have already clicked on that panel. Last edited: Mar 19, 2020 Upvote 0
B4X: Sub check (position As Int) As Boolean For i=0 To lanswer.Size-1 If lanswer.Get(i)=position Then Return True End If Next End Sub B4X: If check(position)=False Then lanswer.Add(position) End If I used a multi-panel and the value of each panel I want to save to when the user clicks again to see if they have already clicked on that panel.
DonManfred Expert Licensed User Longtime User Mar 19, 2020 #4 I dont see how i could help. I do not see you are defining a list here or working with one. Upvote 0
LucaMs Expert Licensed User Longtime User Mar 19, 2020 #5 mohammad3250 said: B4X: Sub check (position As Int) As Boolean For i=0 To lanswer.Size-1 If lanswer.Get(i)=position Then Return True End If Next End Sub Click to expand... List useful method: B4X: If lanswer.IndexOf(position) = - 1 Then ' first time, not added Else lanswer.Add(position) End If Also, see Map objects, they are better. Upvote 0
mohammad3250 said: B4X: Sub check (position As Int) As Boolean For i=0 To lanswer.Size-1 If lanswer.Get(i)=position Then Return True End If Next End Sub Click to expand... List useful method: B4X: If lanswer.IndexOf(position) = - 1 Then ' first time, not added Else lanswer.Add(position) End If Also, see Map objects, they are better.
Erel B4X founder Staff member Licensed User Longtime User Mar 19, 2020 #6 Whenever you want to store non-duplicate items then you need a Map, or B4XOrderedMap or B4XSet. Last two are from B4XCollections. Upvote 0
Whenever you want to store non-duplicate items then you need a Map, or B4XOrderedMap or B4XSet. Last two are from B4XCollections.
M mohammad3250 New Member Mar 20, 2020 #7 solved B4X: Sub check (position As Int) As Boolean For i=0 To lanswer.Size-1 dim item=lanswer.get(i) as typemode If item.id=position Then Return True End If Next Upvote 0
solved B4X: Sub check (position As Int) As Boolean For i=0 To lanswer.Size-1 dim item=lanswer.get(i) as typemode If item.id=position Then Return True End If Next