I am attempting to code for labels (consists of one label with an icon e.g. btn1 and one with text e.g. btn1b) where when one is pressed, the color will change while the other two labels will change to an alternate color. The code below works apart from the line starting with 'If v.name contains'... This is obviously not the correct syntax for B4X, however is there any way to get the name of a label view and determine if that name contains a certain sub string e.g. that v = btn1b and that this contains a 1. I know I could probably do this with tags but I want to use them for something else!
Thanks all who reply!
B4X:
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private btn1, btn1b, btn2, btn2b, btn3, btn3b As Label
Private pnl1, pnl2, pnl3, pnlBar As B4XView
End Sub
Sub btn2_Click
pnl2.BringToFront
For Each v As Label In pnlBar.GetAllViewsRecursive
If v.name contains("1") Then v.textColor = Colors.Red Else v.TextColor = Colors.blue
Next
Thanks all who reply!