B4J Question Color picker dialog

ThRuST

Well-Known Member
Licensed User
Longtime User
Is there an official color picker dialog implemented in B4J or should we use the one from B4A?
 

ThRuST

Well-Known Member
Licensed User
Longtime User
Yeah, I found out but no code example how to use it. Besides ControlsFX library does not seem to be compatible with Java 9.0.1. Just tested the example source.
Does it run without errors in the log for you?
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
I found an example by Erel how to create your very own color picker from a modal dialog. Very nice You'll find it here
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
There is a built-in color picker:

SS-2018-02-18_09.25.14.png


Note that jControlsFX9 is compatible with Java 9.
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
Indeed it is there I found it :)

But now I am trying to use the value with CSSUtils to change color in a TextArea text color, but the problem araise because Log is showing in this format 0xff4527 so I tried this but that did not work. Please what's the workaround for this. I dunno how to convert an object into a string here. Thanks Erel I love your product range :)
When I use parameter (Value As Paint) it generates the color Value, but then I cannot use it in CSSUtils either way I'm run into a dead end. Please help me.

B4X:
Sub ColorPicker1_ValueChanged (Value As String)
    
    Dim Str As String
    Str = Value.SubString(2)
    
    Log (Value)
    CSSUtils.SetStyleProperty(TextArea1,"-fx-text-fill", "#" & Str)
    
End Sub
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
I solved it myself this time. Thanks anyway :)

This works

B4X:
Sub ColorPicker1_ValueChanged (Value As Paint)

    Log (Value)   
    CSSUtils.SetStyleProperty(TextArea1,"-fx-text-fill", CSSUtils.ColorToHex(Value))
    Log(CSSUtils.ColorToHex(Value))
    
End Sub
 
Upvote 0
Top