T tcpip Member Licensed User Longtime User Mar 29, 2015 #1 Hi all, i`m trying to make on B4J an autocomplete textfield (or something like this) http://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_input_autocomplete (in HTML) and this https://www.b4x.com/android/forum/t...ive-to-autocompleteedittext.19379/#post111667 (in B4A) The field will show values from a database table. I cannot find anything under www.b4x.com website. Is there anything that can help me?? thanks
Hi all, i`m trying to make on B4J an autocomplete textfield (or something like this) http://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_input_autocomplete (in HTML) and this https://www.b4x.com/android/forum/t...ive-to-autocompleteedittext.19379/#post111667 (in B4A) The field will show values from a database table. I cannot find anything under www.b4x.com website. Is there anything that can help me?? thanks
Erel B4X founder Staff member Licensed User Longtime User Mar 30, 2015 #2 I've attached an example that is based on jControlsFX (requires Java 8). The auto completion is not perfect. https://www.b4x.com/android/forum/threads/50700/#content Attachments AutoComplete.zip AutoComplete.zip 3.4 KB · Views: 938 Upvote 0
I've attached an example that is based on jControlsFX (requires Java 8). The auto completion is not perfect. https://www.b4x.com/android/forum/threads/50700/#content
T tcpip Member Licensed User Longtime User Mar 30, 2015 #3 Thank you Erel for your reply. I have added the library but when i try to run this example i get this error: Program started. Error occurred on line: 23 (main). java.lang.ClassNotFoundException: org.controlsfx$control$textfield$TextFields at anywheresoftware.b4j.object.JavaObject.getCorrectClassName(JavaObject.java:287) at anywheresoftware.b4j.object.JavaObject.InitializeStatic(JavaObject.java:73) at b4j.example.main._setautocomplete(main.java:95) at b4j.example.main._appstart(main.java:80) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:563) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:224) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:156) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93) at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:82) at anywheresoftware.b4a.BA.raiseEvent(BA.java:84) at b4j.example.main.start(main.java:36) at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319) at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:219) at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:182) at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:179) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:17) at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:67) at java.lang.Thread.run(Thread.java:745) Upvote 0
Thank you Erel for your reply. I have added the library but when i try to run this example i get this error: Program started. Error occurred on line: 23 (main). java.lang.ClassNotFoundException: org.controlsfx$control$textfield$TextFields at anywheresoftware.b4j.object.JavaObject.getCorrectClassName(JavaObject.java:287) at anywheresoftware.b4j.object.JavaObject.InitializeStatic(JavaObject.java:73) at b4j.example.main._setautocomplete(main.java:95) at b4j.example.main._appstart(main.java:80) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:563) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:224) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:156) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93) at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:82) at anywheresoftware.b4a.BA.raiseEvent(BA.java:84) at b4j.example.main.start(main.java:36) at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319) at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:219) at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:182) at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:179) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:17) at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:67) at java.lang.Thread.run(Thread.java:745)
Erel B4X founder Staff member Licensed User Longtime User Mar 30, 2015 #4 Make sure that the library is still checked in the libraries list. And make sure to use Java 8 under Tools - Configure Paths. Upvote 0
Make sure that the library is still checked in the libraries list. And make sure to use Java 8 under Tools - Configure Paths.
T tcpip Member Licensed User Longtime User Mar 30, 2015 #5 I installed java8 and added the path....but i get now another error Cannot find: C:\Program Files (x86)\Anywhere Software\B4J\libraries\controlsfx-8.jar Upvote 0
I installed java8 and added the path....but i get now another error Cannot find: C:\Program Files (x86)\Anywhere Software\B4J\libraries\controlsfx-8.jar
T tcpip Member Licensed User Longtime User Mar 30, 2015 #6 Its ok Erel. I found and download the controlsfx library and now is working. And it seems good. thanks Upvote 0
Its ok Erel. I found and download the controlsfx library and now is working. And it seems good. thanks
Fabrice La Active Member Licensed User Longtime User Oct 20, 2016 #7 I am using the SetAutoComplete. work nice. Now i would like to use the Event that select the word (Event click the word in the autoComplete list )? Upvote 0
I am using the SetAutoComplete. work nice. Now i would like to use the Event that select the word (Event click the word in the autoComplete list )?
Erel B4X founder Staff member Licensed User Longtime User Oct 20, 2016 #8 There is no such event. You can use the TextChanged event and check whether the current text matches one of the items. Upvote 0
There is no such event. You can use the TextChanged event and check whether the current text matches one of the items.
L le_toubib Active Member Licensed User Longtime User Jan 12, 2017 #9 Erel said: I've attached an example that is based on jControlsFX (requires Java 8). The auto completion is not perfect. https://www.b4x.com/android/forum/threads/50700/#content Click to expand... hello all is there a way to increase font size of the drop down list ??? Also , is there a way to keep the list from appearing in case i add text programatically ?? Last edited: Jan 12, 2017 Upvote 0
Erel said: I've attached an example that is based on jControlsFX (requires Java 8). The auto completion is not perfect. https://www.b4x.com/android/forum/threads/50700/#content Click to expand... hello all is there a way to increase font size of the drop down list ??? Also , is there a way to keep the list from appearing in case i add text programatically ??
Erel B4X founder Staff member Licensed User Longtime User Jan 12, 2017 #10 You can change the font size: 1. Create a css file: Code: .auto-complete-popup { -fx-font-size: 20; } 2. Load it: Code: MainForm.Stylesheets.Add(File.GetUri(File.DirAssets, "test.css")) There is no simple way to prevent the list from opening. Upvote 0
You can change the font size: 1. Create a css file: Code: .auto-complete-popup { -fx-font-size: 20; } 2. Load it: Code: MainForm.Stylesheets.Add(File.GetUri(File.DirAssets, "test.css")) There is no simple way to prevent the list from opening.
L le_toubib Active Member Licensed User Longtime User Jan 12, 2017 #11 thanx erel for replying is there a way to make the list width larger ? and height ? Upvote 0
EnriqueGonzalez Expert Licensed User Longtime User Jan 13, 2017 #12 did not test, but something like this: Code: .auto-complete-popup .list-view { -fx-pref-width:100; } Upvote 0
jmon Well-Known Member Licensed User Longtime User Jan 13, 2017 #13 You can try my autocomplete library, it's quite fast and simple to setup: https://www.b4x.com/android/forum/threads/quicktextselect-based-on-levenshtein-distance.67281/ I use it on textfields in my apps Upvote 0
You can try my autocomplete library, it's quite fast and simple to setup: https://www.b4x.com/android/forum/threads/quicktextselect-based-on-levenshtein-distance.67281/ I use it on textfields in my apps
M MAGAREY Member Licensed User Longtime User May 9, 2019 #14 its posible to get the textfield view, catching it from the sender? I tried this but without success: Code: Sub autocompleted_Event (MethodName As String, Args() As Object) As Object Log("Success") Log(Args.Length) Dim jo As JavaObject = Args(0) Log(jo.RunMethod("getCompletion",Null)) dim b as textfield b=Sender log(b) Return False End Sub Upvote 0
its posible to get the textfield view, catching it from the sender? I tried this but without success: Code: Sub autocompleted_Event (MethodName As String, Args() As Object) As Object Log("Success") Log(Args.Length) Dim jo As JavaObject = Args(0) Log(jo.RunMethod("getCompletion",Null)) dim b as textfield b=Sender log(b) Return False End Sub
EnriqueGonzalez Expert Licensed User Longtime User May 10, 2019 #15 dim b as textfield = sender should ALWAYS be your first line in the sub Upvote 0
ThRuST Well-Known Member Licensed User Longtime User Jul 25, 2019 #16 @Erel You mentioned that it's not "perfect", so what's wrong with the example? it seems to work just fine. Can you perhaps make the neccessary improvements after all this time. Upvote 0
@Erel You mentioned that it's not "perfect", so what's wrong with the example? it seems to work just fine. Can you perhaps make the neccessary improvements after all this time.
Erel B4X founder Staff member Licensed User Longtime User Jul 26, 2019 #17 When I tested it a few years ago there were issues with the list width. Might have been fixed in ControlsFX 9. There are better options available now such as MiniSearchView, SearchView or Search template from XUI Views. ThRuST said: Can you perhaps make the neccessary improvements after all this time. Click to expand... The time passed is not a factor that I consider. Upvote 0
When I tested it a few years ago there were issues with the list width. Might have been fixed in ControlsFX 9. There are better options available now such as MiniSearchView, SearchView or Search template from XUI Views. ThRuST said: Can you perhaps make the neccessary improvements after all this time. Click to expand... The time passed is not a factor that I consider.
ThRuST Well-Known Member Licensed User Longtime User Jul 26, 2019 #18 @Erel I really like your example and would like to use it, but as it works now one have to press enter to select the item from the list then press enter again to perform the websearch, this is not smooth enough for my needs. Is there a way to directly after selection trigger the code to perform the search? Perhaps Enrique allready answered my question, this has to be tested. Upvote 0
@Erel I really like your example and would like to use it, but as it works now one have to press enter to select the item from the list then press enter again to perform the websearch, this is not smooth enough for my needs. Is there a way to directly after selection trigger the code to perform the search? Perhaps Enrique allready answered my question, this has to be tested.
Erel B4X founder Staff member Licensed User Longtime User Jul 28, 2019 #19 You can probably monitor the TextChanged event. As I wrote there are better options available. Upvote 0
ThRuST Well-Known Member Licensed User Longtime User Jul 28, 2019 #20 That works, but it would be neccessary to check for enter keypress so I'll try that as well. I found a solution here Upvote 0
That works, but it would be neccessary to check for enter keypress so I'll try that as well. I found a solution here