B4J Question Manage background of disabled textField

rossati

Active Member
Licensed User
Longtime User
Hello

I am not able to manage the background of disabled text Field; the best I've managed to get is adding to a css asset file this (copied from pastebin.com):
.text-field:disabled {
-fx-opacity: -fx-disabled-opacity;
}
this works (partially) but in the log I have this error:
WARNING: Could not resolve '-fx-disabled-opacity' while resolving lookups for '-fx-opacity' from rule '*.text-field:disabled' in stylesheet jar:file:/C:/Sviluppo/B4J/formgen/Objects/formgen.jar!/Files/sbFgen.css
ago 11, 2017 8:57:29 AM javafx.scene.CssStyleHelper calculateValue
WARNING: Could not resolve '-fx-disabled-opacity' while resolving lookups for '-fx-opacity' from rule '*.text-field:disabled' in stylesheet jar:file:/C:/Sviluppo/B4J/formgen/Objects/formgen.jar!/Files/sbFgen.css

Where i can found a documentation, and samples?

Thanks

Giovanni Rossati
 

rossati

Active Member
Licensed User
Longtime User
Thanks

I know the JavaFx reference guide bat because I am not yet very trained on it i am not able for example to to aligne a label using:
-fx-text-alignment: right;

Giovanni Rossati
 
Upvote 0

rwblinn

Well-Known Member
Licensed User
Longtime User
For changing styles, the recommendation is to use the CSSUtils Library.

Example related to your questions
B4X:
Private TextField2 As TextField

TextField2.Text = "This textfield is not enabled"
TextField2.Enabled = False

CSSUtils.SetBackgroundColor(TextField2, fx.Colors.ARGB(100,255,0,0))
CSSUtils.SetStyleProperty(TextField2, "-fx-alignment", "center-right")

upload_2017-8-12_11-4-42.png
 
Upvote 0

rossati

Active Member
Licensed User
Longtime User
Thanks

The background color of a not enabled TextField is darked; I used a not editable TextField for see a desired color.
Since I was not able to align a text on label to right, I used a non-editable TextField.
Giovanni Rossati
 
Upvote 0
Top