, PageIRC As [IRC Page], PgPDF As [PDF Page] FROM TableList221", False, Array As String("T", "T", "T", "I"))
'I made a small change to the xTableLite class of Klaus, just to have the app wait for the table to be fully loaded before doing other things
Wait For (xtblItems.LoadSQLiteDB2(sql,"SELECT DescriptionSubjectLookup, TableNumber as
, PageIRC As [IRC Page], PgPDF As [PDF Page] FROM TableList221", False, Array As String("T", "T", "T", "I"))) complete (Comp As Object)
'Here we populate the List that will help us for the Search Function
lstSearch.Initialize
For x = 0 To xtblItems.Size - 1
Dim item() As String = xtblItems.GetValues(x)
lstSearch.Add(item)
Next
xtblItems.SetColumnsWidths(Array As Int(250dip, 150dip, 90dip, 75dip))
'Setting the Table for Search Result to appear as the original one
xTableSearch.SingleLine = False
xTableSearch.SetHeader(Array As String ("DescriptionSubjectLookup", "Table", "IRC Page", "PDF Page"))
xTableSearch.SetColumnsWidths(Array As Int(250dip, 150dip, 90dip, 75dip))
timerSearch.Initialize("Search", 1000) 'Timer set to wait for 1 second after writing before start Search.
ime.Initialize("") 'Initialize the library to hide the keyboard later
End Sub
Sub btnQuit_Click
If btnQuit.Text = "Back" Then
ZoomImageView1.mBase.Visible = False
btnQuit.Text = "Exit"
Else
sql.Close
#If B4i
xui.MsgboxAsync("You cannot exit with this button", "Warning")
#Else
ExitApplication
#End If
End If
End Sub
Private Sub xtblItems_CellClick(col As Int, row As Int)
ImageFileName = xtblItems.GetValue(1, row) & ".png"
If File.Exists(File.DirAssets, ImageFileName) Then
ShowImage
Else
xui.MsgboxAsync("Image " & ImageFileName & " does not exist.", "Warning")
End If
End Sub
Private Sub ShowImage
btnQuit.Text = "Back"
ZoomImageView1.SetBitmap(xui.LoadBitmap(File.DirAssets, ImageFileName))
ZoomImageView1.mBase.Visible = True
End Sub
Private Sub lblSearch_Click
'Hide the Title bar and make available the EditText for Search, and the icon to close the search function.
'It even hide the original table and show the one for search results.
lblTitle.Visible = False
lblSearch.Visible = False
lblCancel.Visible = True
edtSearch.Visible = True
edtSearch.Text = ""
xtblItems.Visible = False
xTableSearch.Visible = True
xTableSearch.ClearAll
End Sub
Private Sub lblCancel_Click
'Hide everything related to the Search function and show again the Title Bar and the icon for Search
edtSearch.Visible = False
lblCancel.Visible = False
lblSearch.Visible = True
lblTitle.Visible = True
xTableSearch.Visible = False
xTableSearch.ClearAll
xtblItems.Visible = True
ime.HideKeyboard
End Sub
Private Sub edtSearch_TextChanged (Old As String, New As String)
If New = "" Then Return 'If EditText is empty no search will be done
SearchPattern = New 'Copy the editext content as the pattern to search for
writing = True 'Variable to set that we are writing something and to avoid immediate unneeded search
xTableSearch.ClearAll 'Clear the search results table
timerSearch.Enabled = True 'Start the timer to check when possible to begin the search
End Sub
Private Sub Search_Tick
If writing Then 'If we are writing no search will start
writing = False
Return
End If
timerSearch.Enabled = False 'Stop the timer because a search will start
For x = 0 To lstSearch.Size - 1 'Call the check of every single item simultaneously using a ResumableSub
FastSearch(x) 'Just call a single item check
Sleep(0)
Next
End Sub
Private Sub FastSearch (what As Int)
Dim myitem() As String = lstSearch.Get(what) 'Get the item to analyze from the List
Sleep(0) 'Just not to let the app to hang up
For y = 0 To 3
If myitem(y).ToUpperCase.Contains(SearchPattern.ToUpperCase) Then 'Check all of the four Table fields. If the pattern is found then add it to the search table results
xTableSearch.AddRow(Array As String (myitem(0), myitem(1), myitem(2), myitem(3))) 'Add the found item
Sleep(0)
End If
Next
End Sub
Private Sub xTableSearch_CellClick(col As Int, row As Int)
ime.HideKeyboard
ImageFileName = xTableSearch.GetValue(1, row) & ".png"
If File.Exists(File.DirAssets, ImageFileName) Then
ShowImage
Else
xui.MsgboxAsync("Image " & ImageFileName & " does not exist.", "Warning")
End If
End Sub[/CODE]
. My search ability is limited. If I use more than one keyword I only get results if the exact occurrence is found in my db. I'd like for all and any records to be brought up no matter what arrangement the keywords might be typed into the search.
Thanks for any help