B4J Question Invoc escape button

Erel

B4X founder
Staff member
Licensed User
Longtime User
If you want to prevent the auto complete text field from popping then you can use this code:
B4X:
Sub Process_Globals
   Private fx As JFX
   Private MainForm As Form
   Private tf As TextField
   Private AutoCompletionBinding As JavaObject
End Sub

Sub AppStart (Form1 As Form, Args() As String)
   MainForm = Form1
   'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
   MainForm.Show
   MainForm.RootPane.LoadLayout("1")
   MainForm.Stylesheets.Add(File.GetUri(File.DirAssets, "test.css"))
   SetAutoComplete(File.ReadList(File.DirAssets, "cities.txt"), tf)
End Sub

Sub IgnoreInputChanges (ignore As Boolean)
   Dim r As Reflector
   r.Target = AutoCompletionBinding
   r.SetField("ignoreInputChanges", ignore, "java.lang.boolean")
End Sub

Sub SetAutoComplete(Items As List, Field As TextField)
   Dim jo As JavaObject
   jo.InitializeStatic("org.controlsfx.control.textfield.TextFields")
   AutoCompletionBinding = jo.RunMethod("bindAutoCompletion", Array(Field, Items))
End Sub
 
Upvote 0

le_toubib

Active Member
Licensed User
Longtime User
thanx erel :)
And when should I call the function ignoreinputchanges ? E.g: Before or after setting new text ?
 
Last edited:
Upvote 0
Top