Other B4J Colorpicker control

touchsquid

Active Member
Licensed User
In the Java layout designer there is a colorpicker control. When I use it in a layout it works, but the "generate members" dialog does not show any event for color changed. I tried MouseClicked but that happens BEFORE the color change.

I am able to use the FocusChanged event to get the color value(using JavaObject) but that only happens if the user clicks another button. Any idea how to get the color change event?

Thanks!
 

touchsquid

Active Member
Licensed User
Got it working:
B4X:
        Dim CP As JavaObject = FColorChoice 'the colorpicker control ID
        Dim E As Object = CP.CreateEventFromUI("javafx.event.EventHandler","FColorChoice",Null)
        CP.RunMethod("setOnAction",Array(E))
Event:
B4X:
Sub FcolorChoice_Event(MethodName As String,Args() As Object)
    Dim JO As JavaObject = FColorChoice
    Dim colorvalue As String = JO.RunMethod("getValue", Null)   
    Log(colorvalue)
End Sub
 
Top