B4J Question How to set CSS of [ControlFX] PropertySheet control's inner components?

m4.s

Member
Licensed User
Longtime User
I've been able to style my application's several PropertySheet controls using - e.g.:

B4X:
cpsSettings.Style = "-fx-border-color: darkgrey; -fx-background:transparent;"

which yields this:



But I don't know how to style the field labels (from the auto-set and hard-to-read white color above instead to, say, black).

Further, I have no idea if/how to style the [by name or category] filter toolbar background's color.

As a nice-to-have, I'd like the option to also style the property sheets' individual sub-components (like the text field above, and the 3 other types shown below as examples):




I'd prefer to ultimately add several property sheet-specific style classes (loaded from my application's main .css file), like shown here - e.g.:

B4X:
.MyPropertySheet1 .property-sheet {
    -fx-background:  transparent;
    -fx-border-color: darkgrey;
    ??
    ??
    ....
}
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
This is the only solution I've found:
B4X:
Sub ShowRecord
    Sheet.Set(records.Get(index), SheetMeta)
    btnPrevious.Enabled = index > 0
    btnNext.Enabled = index < records.Size - 1
    lblRecordIndex.Text = $"${index + 1} / ${records.Size}"$
    Sleep(0)
    Dim x As B4XView = Sheet
    For Each v As B4XView In x.GetAllViewsRecursive
        If v Is Label Then
            v.TextColor = xui.Color_Red
        End If
    Next
End Sub

Check B4XPreferencesDialog, especially if you are building a cross platform solution.
 
Upvote 0

m4.s

Member
Licensed User
Longtime User

Thanks Erel.

I could not get your above For Each loop to work in my code. However, after some experimentation, I observed that the default white label color was being auto-set as a result of setting each of my property sheets' [CSS] style to include -fx-background: transparent;. Once I changed those ps background values to the same color as their parent panes instead, all the ps component labels then took on the normal light black color - e.g.:



I decided the default light grey and white background colors for all the ps component fields are actually just fine (i.e. no need to CSS style any of them).

So, all is good re: this now!
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…