Bug? B4J 4.20 CSSUtils GetStyleProperty Empty Result

rwblinn

Well-Known Member
Licensed User
Hi,

when setting and getting a CSSUtils StyleProperty, the result is empty.
Is this a bug or is the parameter setting wrong?

B4X:
'Set
CSSUtils.SetStyleProperty(Label1, "-fx-font-size", "32")
'Get = Result is empty string
Log($"CSSUtils Libary GetStyleProperty for Label=${CSSUtils.GetStyleProperty(Label1, "-fx-font-size")}"$)

'Used own version as below returning full property with value
Log($"CSSUtils Libary GetStyleProperty for Label=${GetStyleProperty2(Label1, "-fx-font-size")}"$)

Public Sub GetStyleProperty2 (Node As Node, Key As String) As String
    Dim m As Matcher = Regex.Matcher($"${Key}:[^;]+;"$, Node.Style)
    If m.Find Then
        Return m.Group(0)
    Else
        Return ""
    End If
End Sub

Example project attached.
 

Attachments

  • CSSUtils.zip
    2.3 KB · Views: 114
Top