Bug? B4JTextFlow Error

Status
Not open for further replies.

Diego Roman

Member
Licensed User
Hi, i have an error in B4J 8.10 when i try to use B4JTextFlow
First add library XUI Views to the project, then


Here the code:

B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    'MainForm.RootPane.LoadLayout("1") 'Load the layout file.
    
    Dim tf As B4JTextFlow
    tf.Initialize
    tf.Append("1 2 3").SetColor(fx.Colors.Red).SetUnderline(True)
    tf.Append(" 4 5 6 ").SetColor(fx.Colors.Green).SetFont(fx.CreateFont("", 17, True, True))
    tf.Append("7 8 9").SetColor(fx.Colors.Blue).SetStrikethrough(True).SetFont(fx.DefaultFont(20))
    Dim p As Pane = tf.CreateTextFlow
    MainForm.RootPane.AddNode(p, 10, 10, 200, 100)
    MainForm.Show
End Sub


But I get the following error:

Waiting for debugger to connect...
Program started.
Ha ocurrido un error en la línea: 20 (B4JTextFlow)
java.lang.NumberFormatException: For input string: "0xff0000ff"
at sun.misc.FloatingDecimal.parseHexString(FloatingDecimal.java:2071)
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1870)
at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
at java.lang.Double.parseDouble(Double.java:538)
at anywheresoftware.b4a.BA.ObjectToNumber(BA.java:395)
at b4j.example.main._appstart(main.java:96)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:632)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
at b4j.example.main.start(main.java:38)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$4(WinApplication.java:186)
at java.lang.Thread.run(Thread.java:748)


Could you help me by indicating why it doesn't work, I have checked the code in the B4J manuals and also the forum and it looks the same,
I don't know where the error is.
Thank you
 

stevel05

Expert
Licensed User
Longtime User
As a Guess, I assume B4jTextflow is a B4x view, so you will need to use int's for the colors. Use XUI.Color_Red etc instead of fx.Colors.Red

And Dim XUI as XUI in Globals
 

Diego Roman

Member
Licensed User
That's correct thank you very much

You know if there is a B4J manual that has all this information updated?
I'm currently studying the Beginners Guide, but when I try it in B4J I get certain errors and I find it hard to know why.
I guess that the manuals found on the internet are outdated.

Thank you
 

klaus

Expert
Licensed User
Longtime User
Please, use standard text sizes, there is really no need to use special text sizes nor special fonts.
It's more difficult to read and it will not increase the answer speed.
I'm currently studying the Beginners Guide,
Which guide did you study?
The Beginners Guides for all B4X products are outdated, the most recent documentation about B4X is the B4X Documentation Booklets.
If you used the inline links in the B4X Documentation Booklets, yes, almost all booklets have the name of Beginners' Guide. This is a known issue and it is amended for the next uopdate.
You know if there is a B4J manual that has all this information updated?
At my knowledge no! And I'm afraid that there will never be any B4J manual covering anything about B4J.

Looking at your code, it seems that you need to study the basics.
You haven't load any layout, so where is B4JTextFlow defined?

Otherwise, post your project as a zip file.
So we could have a look at it and give you a concrete advice.
 
Status
Not open for further replies.
Top