Bug? [Solved] Setting Background Colour of a multiline B4XFloatTextField

BlueVision

Well-Known Member
Licensed User
Longtime User
Works fine normally in this way.
B4X:
            B4XTextFiedl.TextField.Color = XUI.Color_ARGB(255,255,69,0)
Now change the field properties in the designer to multiline.
The field will not change it's colour anymore. You can see a small border with the desired colour around the field, the field itself remains in default colour.
Do I have to adress something else than TEXTFIELDCOLOR in case the field is multiline or is it a bug?
 

PaulMeuris

Well-Known Member
Licensed User
1745063902242.png

B4J test...
In single line mode a TextField is used and in multi line mode a TextArea is used.
To set the color you could do the following:
B4X:
    If B4XFloatTextField1.TextField Is TextField Then
        B4XFloatTextField1.TextField.Color = xui.Color_ARGB(255,255,69,0)        'OrangeRed
    Else
        Dim ta As TextArea = B4XFloatTextField1.TextField
        ta.Style = "-fx-focus-color:transparent;-fx-text-box-border:transparent;-fx-control-inner-background:OrangeRed;"
    End If
Now you can change the multiline checkbox in the designer to whatever you want.
 

BlueVision

Well-Known Member
Licensed User
Longtime User
Thanks Paul, it works (as far as the colours are concerned).

CSS styles are one of those things that regularly drive me to despair and are therefore very much hated by me. If I change the properties of an object with CSS, other previously defined object properties lose their assigned values. The colour is now correct...

Additional hint: Limit the changes done with CSS to a minimum in this case. The full line of CSS commands will affect bordersize and bordercolour.
 
Last edited:

TILogistic

Expert
Licensed User
Longtime User
tips:
 
Top