This Custom View does not get much interest, I would say (I hope only because of its name. Its name may suggest the classic hint of EditText but it is not so and the classic hint is still available, for its different purpose. The name of this Custom View should be AutoCompleteEditText or AutoCompleteView, but then it would be confused with existing ones).
Despite this, since I promised to add a minimum of documentation...
Use cases: as mentioned, lack of space for use Views like SearchView (space for the ListView; mainly on smatphones in landscape). So, same use cases of SearchView.
METHODS (alphabetical order):
Add (Word As String):
Allows you to add a single word (text line) to the "list" (db table).
Ex: SuggestionsEditText1.Add("Sarchiapone nano")
AddAll (lstWords As List):
Allows you to add a list of words.
Ex: SuggestionsEditText1.Add(Array As String("Sarchiapone nano", "Gatto", "Cane"))
Ex2: SuggestionsEditText1.Add(lstAnimals) [where lstAnimals is a List object, of course]
V. 1.3
AddAllAsync (lstWords As List):
Same as AddAll but this uses the asynchronous SQLite method AddNonQueryToBatch.
Raises the AddAllAsyncComplete event.
Ex: SuggestionsEditText1.AddAllAsync(Array As String("Sarchiapone nano", "Gatto", "Cane"))
Ex2: SuggestionsEditText1.AddAllAsync(lstAnimals) [where lstAnimals is a List object, of course]
AddToParent (Parent As View, Left As Int, Top As Int, Width As Int, Height As Int):
Allows you to add a SuggestionsEditText by code instead of by Designer.
Ex: SuggestionsEditText1.AddToParent(Panel1, 0, 0, 50%x, 50dip)
Contains (Word As String) As Boolean [function]:
To know if the specified word is already in the "list" (db table).
Ex: If SuggestionsEditText1.Contains("Dog") = True Then...
DeleteAllWordsDBs (Dir As String):
Deletes all old, unneeded db files previously associated to all your SuggestionsEditText views.
You should invoke this method once and before all other "operations" on SuggestionsEditText views.
Also,
Dir will be the directory where db files will be saved.
Ex: SuggestionsEditText1.DeleteAllWordsDBs("") - Null String implies File.DirInternal.
GetBackgroundEditText:
Allows you to get the background EditText, used "as base" of SuggestionsEditText, to change its all properties .
Ex: Dim ET As EditText = SuggestionsEditText1.GetBackgroundEditText
GetBase:
To get the panel used as base of any CustomView (added by Designer)
Ex: Dim pnlBase As Panel = SuggestionsEditText1.GetBase
GetForegroundEditText:
To get the foreground EditText, which will contain the text entered by the user.
Ex: Dim ET As EditText = SuggestionsEditText1.GetForegroundEditText
InitWordsDB:
Initializes the DB associated to the SuggestionsEditText.
Ex: SuggestionsEditText1.InitWordsDB
V. 1.1
InitWordsDB2(SuggET As SuggestionsEditText):
Allows you to use the DB of the specified SuggestionsEditText.
Ex: SuggestionsEditText2.InitWordsDB(SuggestionsEditText1)
RemoveAllWords:
Removes all words saved for that SuggestionsEditText.
Ex: SuggestionsEditText1.RemoveAllWords
RemoveWord (Word As String):
Removes the specified word.
Ex: SuggestionsEditText1.Remove("Cat")
PROPERTIES (alphabetical order):
BackTextColor:
Sets / Gets the color used for the suggestion text.
Ex: SuggestionsEditText1.BackTextColor = Colors.Gray
CaseSensitive:
Sets / Gets if the search taking in account lowercase and uppercase or not.
Ex: SuggestionsEditText1.CaseSensitive = True
Color:
Same Color property of any other B4X view, so:
View attachment 54251
The color will be applied to the BackgroundEditText (the ForegroundEditText color is transparent)
V. 1.1
DB:
Gets the DB associated to the SuggestionsEditText.
Ex: Dim SQL1 As SQL = SuggestionsEditText1.DB
DBDir:
Gets the Directory which contains the DB associated to the SuggestionsEditText.
Ex: Dim DBFolder As String = SuggestionsEditText1.DBDir
DBFileName:
Gets the file name of the DB associated to the SuggestionsEditText.
Ex: Dim DBFileName As String = SuggestionsEditText1.DBFileName
ForceDoneButton:
Forces Android to display Done as Action Key in the virtual keyboard.
Ex: SuggestionsEditText1.ForceDoneButton = True
V. 1.3
HintText:
Same Hint Text property of EditTexts.
InDBOnly:
Used to set if any words will be accepted or only those present in the db table.
Ex: SuggestionsEditText1.InDBOnly = True
V. 2.0
KBFullScreen:
Sets Keyboard full screen on/off
V. 1.3
KBSuggestions:
Sets the Keyboard's suggestions on/off
Text:
Same Text property of any other B4X view. The Foreground text will be set.
TextColor:
Same TextColor property of any other B4X view. The Foreground text color will be set.
Events:
TextChanged,
EnterPressed and
FocusChanged: same events of B4a EditText view.
V. 1.3
AddAllAsyncComplete (Success As Boolean)
Raised by the AddAllAsync method.