Android Question Saving label text colours to an array

Roger Daley

Well-Known Member
Licensed User
Longtime User
Hi All,

I know I should know this one, but the brain cells just don't click.

I have a number of lables lblF0 - lblF15 in which the textcolour changes. At some point I need to preserve the current text colours. I have attempted to do this in a for/next in various ways but all have failed.
Below was the code starting point but this stores a string [eg "lblF1.TextColor"] not the color number.

B4X:
Dim Fcolours(16) As String
    For FCol = 0 To 15
        Fcolours(FCol) = "lblF"&FCol&".TextColor"
    Next

Regards Roger
 

stevel05

Expert
Licensed User
Longtime User
If you can now read the colour directly from the Label, do you need to store it somewhere else?

Edit, sorry should have reread the first post.:(
 
Upvote 0

Roger Daley

Well-Known Member
Licensed User
Longtime User
If you can now read the colour directly from the Label, do you need to store it somewhere else?

Edit, sorry should have reread the first post.:(


Steve105,

I should have said in first post the text colour in the label indicates if there is an associated function. In some modes all these functions are disabled and re-enabled in the original mode. Therefore I need to save the text colour when leaving on mode and restore it when returning.

I thought a For/Next loop would be simple, I have gone for the 16 lines of code solution.

Thanks for the reply
Roger
 
Upvote 0
Top