For the time being, to get me moving in my project, what I was thinking was about the possibility of adding 2 elements to the List that is used in the SearchView
ie ItemName and ItemCode. I know that with this solution I cannot display both the ItemName and ItemCode to the user, instead ItemName can be shown to the user and when the user clicks on the ItemName, ItemCode canbe assigned/retrieved to some variable in the Activity Module
For eg. in the section where I fill data to the SearchView
' Fill the SearchView with the required data
Sub FillSvItemsList(result As DBResult)
StockItemsList.Initialize
StockItemsList.Clear
For Each records() As Object In result.Rows
'StockItemsList.Add( records(result.Columns.Get("StockItems_Name")) )
MyRow() As String
Row = (records(result.Columns.Get("StockItems_Name")), records(result.Columns.Get("StockItems_Code")) )
StockItemsList.Add( MyRow )
Next
svStockItemsListIndex = svStockItemsName.SetItems(StockItemsList)
End Sub
Then in the SearchView module, I will add a Public Variable to hold the ItemCode of the chosen/clicked item
For eg
Public MyVarToHoldStockItemCode as String
And in my Activity Module, I will try to access the Code something as follows
Sub svStockItemsName_ItemClick (Value As String)
cItemName = Value
cItemCode = svStockItemsName.MyVarToHoldStockItemCode
End Sub
Still puzzled with how to code this in SearchView Module's following Sub's
Public Sub SetItems(Items As List) As Object
Private Sub AddItemsToList(li As List, full As String)
Private Sub lv_ItemClick (Position As Int, Value As Object)
et.Text = Value
et.SelectionStart = et.Text.Length
Dim IME As IME
IME.HideKeyboard
lv.Visible = False
If SubExists(mCallback, mEventName & "_ItemClick") Then
CallSub2(mCallback, mEventName & "_ItemClick", Value)
End If
End Sub
I don't know whether I am moving in the right direction.
But I still wonder, why such an inbuilt view is not available in B4A environment. Am I, the only person with such a requirement?. In other application development tools that I have used, I never had to spend time on building such views/control, and I could concentrate on developing my business app rather than creating the tools.