B4J Question TextField font color?

techknight

Well-Known Member
Licensed User
Longtime User
How do I change the font color of the text field?

I tried the text-fill CSS property but its changing the whole thing
 

stevel05

Expert
Licensed User
Longtime User
If you only want to change a few text fields, you can use CSSUtils. If you want to do it in a CSS file then you will need to add a unique class to those textfields you want to alter.
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
Dont think your understanding what I am saying.

When I use text-fill with CSSutils, its changing the color of the entire textbox including the font.

B4X:
txtTeamNameHome.Style = "-fx-text-fill: #" & TeamNameHomeColor & ";"

Works but changes the whole thing
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
No I didn't understand the question.

You are not using CSSUtils in your code, any other styles already set in txtTeamNameHome.Style will be lost with your code.

Having said that, just as a test, this code:

B4X:
TextField1.Style = "-fx-text-fill: Red;"

gives me this result:

upload_2018-9-26_15-54-20.png


B4X:
CSSUtils.SetStyleProperty(TextField1,"-fx-text-fill","Red")

Gives me the same result.

Have you changed anything else for that field either with inline css, the designer or in a style sheet?
 
Last edited:
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
I am pretty sure you cannot just change individual letter colours in a Textfield.
So SomeThingLikeThis can not appear in a Textfield.
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
Odd.

Ok. I didnt know it overwrote all the existing CSS, that makes sense then. Becuase when I ran it, it would turn the whole box back white. When I had it set black in the Designer.

I tried SetStyleProperty and that worked better.
 
Upvote 0
Top