InputMultiList help

JonPM

Well-Known Member
Licensed User
Longtime User
Hello, I need to use InputMultiList to give the user selections, and each selection is given a score. Example
InputMultiList gives 3 checkboxes, the first on is worth 2points, the second is worth 1 point, and the third is worth 4 points. After the user makes the selection, I need to add up all of the points. Not sure how to accomplish this, any advice?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I find InputMap easier to work with.
Here is an example:
B4X:
Sub Activity_Create (FirstTime As Boolean)
   Dim options As Map
   Dim scores As List
   options.Initialize
   scores.Initialize
   options.Put("Option 1", False)
   options.Put("Option 2", False)
   options.Put("Option 3", False)
   scores.AddAll(Array As Int(2, 1, 4))
   InputMap(options, "Choose options")
   Dim score As Int
   For i = 0 To options.Size - 1
      If options.GetValueAt(i) = True Then score = score + scores.Get(i)
   Next
   Msgbox("Score=" & score, "")
End Sub
 
Upvote 0

Wien.Mart

Member
Licensed User
Longtime User
Is it possible to use InputMap and InputMultiList with data from a table? Can anybody share some code snippets? Thanks.
 
Upvote 0
Top