advansis Active Member Licensed User Longtime User Oct 21, 2019 #1 Hi guys, anyone knows how to set and get the "value" of the listview in B4XSearchTemplate ? I need to display/search a string value and "lookup" another value. In the standard way, I populate the list as: Code: Dim src As B4XSearchTemplate Dim L As List L.Initialize L.add("First item") L.add("Second item") L.add("Third item") src.SetItems(L) I would like to do something like: Code: Dim src As B4XSearchTemplate Dim M As Map M.Initialize M.put(1,"First item") M.put(3,"Second item") M.put(7,"Third item") src.SetItems(M) So that, when I choose one item I can have "1" or "3" or "7" [...] instead of "First item" or "Second item" [...] I tried using, but without luck: srcCustomListView1.AddTextItem src.CustomListView1.GetValue([...]) Thanks in advance
Hi guys, anyone knows how to set and get the "value" of the listview in B4XSearchTemplate ? I need to display/search a string value and "lookup" another value. In the standard way, I populate the list as: Code: Dim src As B4XSearchTemplate Dim L As List L.Initialize L.add("First item") L.add("Second item") L.add("Third item") src.SetItems(L) I would like to do something like: Code: Dim src As B4XSearchTemplate Dim M As Map M.Initialize M.put(1,"First item") M.put(3,"Second item") M.put(7,"Third item") src.SetItems(M) So that, when I choose one item I can have "1" or "3" or "7" [...] instead of "First item" or "Second item" [...] I tried using, but without luck: srcCustomListView1.AddTextItem src.CustomListView1.GetValue([...]) Thanks in advance
Erel B4X founder Staff member Licensed User Longtime User Oct 22, 2019 #2 Code: Dim m As B4XOrderedMap = B4XCollections.CreateOrderedMap M.put("First item", 1) M.put("Second item", 3) M.put("Third item", 7) src.SetItems(M.Keys) 'get the value: Dim value As Int = M.Get(src.SelectedItem) Upvote 0
Code: Dim m As B4XOrderedMap = B4XCollections.CreateOrderedMap M.put("First item", 1) M.put("Second item", 3) M.put("Third item", 7) src.SetItems(M.Keys) 'get the value: Dim value As Int = M.Get(src.SelectedItem)
advansis Active Member Licensed User Longtime User Oct 22, 2019 #3 Thanks Erel. Is there a way to retrieve the B4XOrderedMap from the B4XSearchTemplate? I mean, data population is done in another module (business layer) and I prefer not to create a global variable, if possible. In such cases, I usually use the Tag property to carry my Map, but B4XSearchTemplate doesn't have one. Upvote 0
Thanks Erel. Is there a way to retrieve the B4XOrderedMap from the B4XSearchTemplate? I mean, data population is done in another module (business layer) and I prefer not to create a global variable, if possible. In such cases, I usually use the Tag property to carry my Map, but B4XSearchTemplate doesn't have one.
Erel B4X founder Staff member Licensed User Longtime User Oct 22, 2019 #4 advansis said: In such cases, I usually use the Tag property to carry my Map, but B4XSearchTemplate doesn't have one. Click to expand... Store it in src.mBase.Tag. Upvote 0
advansis said: In such cases, I usually use the Tag property to carry my Map, but B4XSearchTemplate doesn't have one. Click to expand... Store it in src.mBase.Tag.