So I have made a label that acts as a button when pressed and want to change the color of the text in the label when selected. However the text is made using CSBuilder with a FontAwesome icon on the top and small text underneath. The obvious btn2.textColor = Colors.Red does not work and I guess that is because this relates to straight text and not rich text produced by CSBuilder.
While I can just rebuild the text with CSBuilder every time, this is an inelegant way to just change color. Does anyone know if there is a better solution?
CSBuilder code below. In Sub btn1_Click the btn.textColor.Colors.Red has no effect
'This event will be called once, before the page becomes visible.
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
While I can just rebuild the text with CSBuilder every time, this is an inelegant way to just change color. Does anyone know if there is a better solution?
CSBuilder code below. In Sub btn1_Click the btn.textColor.Colors.Red has no effect
'This event will be called once, before the page becomes visible.
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
'Set up menu icons
cs.Initialize.color(0xFF92BF2C).Size(30).Typeface(Typeface.FONTAWESOME).VerticalAlign(0dip).Append(Chr(0xF015)).Pop. _
Typeface(Typeface.DEFAULT_BOLD).Append(CRLF).Size(12).Append("Home").PopAll
btn1.Text = cs
cs.Initialize.color(0xFFE7E7E7).Size(30).Typeface(Typeface.FONTAWESOME).VerticalAlign(0dip).Append(Chr(0xF155)).Pop. _
Typeface(Typeface.DEFAULT_BOLD).Append(CRLF).Size(12).Append("New Package").PopAll
btn2.Text = cs
cs.Initialize.color(0xFFE7E7E7).Size(30).Typeface(Typeface.FONTAWESOME).VerticalAlign(0dip).Append(Chr(0xF1DA)).Pop. _
Typeface(Typeface.DEFAULT_BOLD).Append(CRLF).Size(12).Append("History").PopAll
btn3.Text = cs
End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
B4X:
Sub btn1_Click
pnl1.BringToFront
btn1.textColor = Colors.Red
End Sub
Attachments
Last edited: