Android Question [Ignore This] B4A MiniSearchview - A MacGyver Guide to Making it Work

mmieher

Active Member
Licensed User
Longtime User
In case it helps someone else ...

Reference:
https://www.b4x.com/android/forum/threads/b4x-xui-minisearchview-autocomplete-field.93564/#content

Spent many hours slogging through the forum doing the rookie-dance with MiniSearchView. Finally came up with something that works for me. Bless @klaus for the B4X Booklet on B4X Custom Views. Klaus is one of a treasured few that were a gift to us from the Old Ones, who brought them to Earth many millennia ago with a mission to ease our learning pain. I need to stop everything I am doing and just read every word in every booklet.

Adding these two little boogers to MiniSearchView.bas brought light to where there was once only darkness:
B4X:
#Event: ItemClick (Index As Int, Value As Object)

B4X:
'    Marc    Long live Klaus
Public Sub GetBase As Panel
    Return mBase
End Sub

There is probably a better way that I could not find, but I made some other modifications so the calling module could figure out what the heck record the user selected. In my case, the "search index" does not contain anything that will uniquely identify the record.

Changed SetItems to take two parameters: the original Index List, and a second List of keys that correspond to the Index List. The idKey is returned as both a Tag in TextField and as a new element in MVSItemData (idkey).
 

Attachments

  • MarcSearchView.bas
    11.7 KB · Views: 215

mmieher

Active Member
Licensed User
Longtime User
Don't use the keyIndex thing. Just figured out it has a major flaw. I don't know how to delete a post.
 
Upvote 0
Top