B4J Question [SOLVED] B4XRadioButton - manage text (size, color, bold)

Elric

Well-Known Member
Licensed User
Hello everybody!

I'm trying to manage the text in B4XRadioButton but not very successfully indeed.

B4X:
    B4XRadioButton1.mLabel.TextColor = xui.Color_Red ' It works
   
    B4XRadioButton1.mLabel.TextSize = 40 ' It doesn't work
    B4XRadioButton1.mLabel.TextSize = B4XRadioButton2.mLabel.TextSize + 25 ' It doesn't work
    B4XRadioButton1.mLabel.TextSize = B4XRadioButton2.mLabel.Font.Size + 25 ' It doesn't work

and how I can set text in "bold"? I cannot find the appropriate property...

Thanks!
 

Attachments

  • B4XRadioButton_Text.zip
    9.3 KB · Views: 116

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can change the text size with the designer.
If you want to change it at runtime then you will need to reset the label style:
B4X:
B4XRadioButton1.mLabel.As(Node).Style = ""
B4XRadioButton1.mLabel.TextColor = xui.Color_Red
B4XRadioButton1.mLabel.TextSize = 40

The "custom view label" CSS style is set by the designer so it needs to be reset. Note that resetting it once is enough.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
You can change the text size with the designer.
If you want to change it at runtime then you will need to reset the label style:
B4X:
B4XRadioButton1.mLabel.As(Node).Style = ""
B4XRadioButton1.mLabel.TextColor = xui.Color_Red
B4XRadioButton1.mLabel.TextSize = 40

The "custom view label" CSS style is set by the designer so it needs to be reset. Note that resetting it once is enough.
I would never have "guessed" that solution.

I suppose it only applies to B4J and that with B4A and B4I it is not necessary.

Maybe it could be implemented in the View but I'm afraid you should create a lot of Label properties. However I suggest it šŸ˜, because obviously it would be useful for the developer, "transparent" and because he may not know/remember it.
 
Upvote 0
Top