B4J Question [Solved] Button lost hover effect when using SetColorAndBorder

aeric

Expert
Licensed User
Longtime User
How can I get back the "shining" effect after setting SetColorAndBorder on button?

Button.gif

B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private xui As XUI
    Private Button1 As B4XView
    Private Activate As Boolean
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1")
    MainForm.Show
End Sub

Sub Button1_Click
    'xui.MsgboxAsync("Hello World!", "B4X")
    If Activate Then
        Activate = False
        Button1.SetColorAndBorder(xui.Color_RGB(30, 144, 255), 0dip, xui.Color_Black, 6dip)
        Button1.Text = "Click Me"
    Else
        Activate = True
        Button1.SetColorAndBorder(xui.Color_RGB(255, 36, 0), 0dip, xui.Color_Black, 6dip)
        Button1.Text = "Clicked"
    End If
End Sub
 

Attachments

  • Button.gif
    Button.gif
    75 KB · Views: 153
Last edited:
Solution
You will need to change it with CSSUtils:
B4X:
CSSUtils.SetBorder(Button1, 1dip, fx.Colors.Red, 4dip)
CSSUtils.SetStyleProperty(Button1, "-fx-base", CSSUtils.ColorToHex(fx.Colors.White))
Top