Midimaster Active Member Licensed User Oct 19, 2020 #1 I would like to send a Jfx-Color to a sub where I asign it to a View, but it looks like the type COLORS in not known in the sub. What do I do wrong? B4X: 'this works: MyButton.TextColor=jfx.colors.red 'this not: SendColor(jfx.colors.red) Sub SendColor(Color as Colors) MyButton.TextColor=Color End Sub
I would like to send a Jfx-Color to a sub where I asign it to a View, but it looks like the type COLORS in not known in the sub. What do I do wrong? B4X: 'this works: MyButton.TextColor=jfx.colors.red 'this not: SendColor(jfx.colors.red) Sub SendColor(Color as Colors) MyButton.TextColor=Color End Sub
DonManfred Expert Licensed User Longtime User Oct 19, 2020 #2 jfx.Colors.Red return an INT-Value and MyButton.TextColor needs an Int-Value. B4X: Sub SendColor(Color as Int) MyButton.TextColor=Color End Sub PS: Sure this is an Android question? Upvote 0
jfx.Colors.Red return an INT-Value and MyButton.TextColor needs an Int-Value. B4X: Sub SendColor(Color as Int) MyButton.TextColor=Color End Sub PS: Sure this is an Android question?
Midimaster Active Member Licensed User Oct 19, 2020 #3 I already tried also this, but it ends up with a crash Code: Log("Spurrow reset color " & index ) SetTextColor(index,Jfx.Colors.yellow) Sub SetTextColor(index As Int, Color As Int ) StudioSpurItem.TextColor=Color End Sub Spurrow reset color 0 Fehler in Zeile: 865 (Main) java.lang.NumberFormatException: For input string: "0xffff00ff" at java.base/jdk.internal.math.FloatingDecimal.parseHexString(FloatingDecimal.java:2082) at java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1870) at java.base/jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110) at java.base/java.lang.Double.parseDouble(Double.java:543) at anywheresoftware.b4a.BA.ObjectToNumber(BA.java:395) at b4j.example.main._spurlabelcolorreset(main.java:1679) at b4j.example.main._metrolbl_mousepressed(main.java:1634) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:632) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167) at jdk.internal.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) 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 anywheresoftware.b4j.objects.NodeWrapper$2.handle(NodeWrapper.java:121) at anywheresoftware.b4j.objects.NodeWrapper$2.handle(NodeWrapper.java:1) .... Click to expand... Upvote 0
I already tried also this, but it ends up with a crash Code: Log("Spurrow reset color " & index ) SetTextColor(index,Jfx.Colors.yellow) Sub SetTextColor(index As Int, Color As Int ) StudioSpurItem.TextColor=Color End Sub Spurrow reset color 0 Fehler in Zeile: 865 (Main) java.lang.NumberFormatException: For input string: "0xffff00ff" at java.base/jdk.internal.math.FloatingDecimal.parseHexString(FloatingDecimal.java:2082) at java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1870) at java.base/jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110) at java.base/java.lang.Double.parseDouble(Double.java:543) at anywheresoftware.b4a.BA.ObjectToNumber(BA.java:395) at b4j.example.main._spurlabelcolorreset(main.java:1679) at b4j.example.main._metrolbl_mousepressed(main.java:1634) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:632) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167) at jdk.internal.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) 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 anywheresoftware.b4j.objects.NodeWrapper$2.handle(NodeWrapper.java:121) at anywheresoftware.b4j.objects.NodeWrapper$2.handle(NodeWrapper.java:1) .... Click to expand...
DonManfred Expert Licensed User Longtime User Oct 19, 2020 #4 It is working for me! The problem is probably in your definition of StudioSpurItem.Textcolor which should be INT Attachments test1.zip test1.zip 8.9 KB · Views: 275 Last edited: Oct 19, 2020 Upvote 0
It is working for me! The problem is probably in your definition of StudioSpurItem.Textcolor which should be INT
klaus Expert Licensed User Longtime User Oct 19, 2020 #5 Are you asking for B4A or B4J? jFX.Colors.Yellow is for B4J and is a Paint object! In B4A, this works. SetTextColor(index, Colors.Yellow) Suggestion: use B4XViews, it will make your life easier. xui colors are integers for all three platforms. Upvote 0
Are you asking for B4A or B4J? jFX.Colors.Yellow is for B4J and is a Paint object! In B4A, this works. SetTextColor(index, Colors.Yellow) Suggestion: use B4XViews, it will make your life easier. xui colors are integers for all three platforms.
Midimaster Active Member Licensed User Oct 19, 2020 #6 oh ! sorry I posted it in B4A. but I need it for B4J klaus said: xui colors are integers for all three platforms. Click to expand... Ah, did'nt know that way! Now it works: B4X: SetTextColor(1,xui.Color_Red) As I transscripe my B4A-project to B4J I was happy only need to add a jfx. in front of all my color commands. But now I see it was the wrong way. Last edited: Oct 19, 2020 Upvote 0
oh ! sorry I posted it in B4A. but I need it for B4J klaus said: xui colors are integers for all three platforms. Click to expand... Ah, did'nt know that way! Now it works: B4X: SetTextColor(1,xui.Color_Red) As I transscripe my B4A-project to B4J I was happy only need to add a jfx. in front of all my color commands. But now I see it was the wrong way.