B4J Question Autocomplete Textfield

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
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
Its ok Erel.
I found and download the controlsfx library and now is working.

And it seems good.

thanks
 
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 )?
 
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"))
SS-2017-01-12_17.14.04.png


There is no simple way to prevent the list from opening.
 
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
 
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.
 
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.

Can you perhaps make the neccessary improvements after all this time.
The time passed is not a factor that I consider.
 
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.
 
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
 
Upvote 0
Back
Top