Niclas Team

unread,
Jan 14, 2016, 3:59:23 AM1/14/16
to MIT App Inventor Forum
Hi,
How can I change the Textcolor of all Labels on Screen 1??

kind regars
Nic

Ghica

unread,
Jan 14, 2016, 7:40:12 AM1/14/16
to MIT App Inventor Forum
The reply depends on whether you want to be able to change the color during execution of your app, or whether you just changed your mind on what the right color is.
There is no magical button to change the color of all labels at the same time. For the design you have to go through each of them and do the change.
If you would like to change the color of the labels when some circumstance in your app would require it, you could cteate a list of your labels during Screen1.initialize and keep it in a global variable. Then, when needed, you do a "for each item in list ..." and use the any blocks to change the color.
Cheers, Ghica.

SteveJG

unread,
Jan 14, 2016, 8:51:13 AM1/14/16
to MIT App Inventor Forum
This tutorial has an example showing how to change all the labels text  

Polyglot … a multilingual tutorial for App Inventor 2

  use it as a template where you use the any component     Label.BackgroundColor  or Label.TextColor  instead of the Label.Text as shown in the example Nic.

Regards,
Steve


Niclas Team

unread,
Jan 14, 2016, 9:13:16 AM1/14/16
to MIT App Inventor Forum
I tried this (see pictures).
but it didn't work :-(
Change_Labelcolor.PNG
Problem.PNG
Screen_initiali.PNG

Ghica

unread,
Jan 14, 2016, 10:24:11 AM1/14/16
to MIT App Inventor Forum
Niclas,
Of course it does not work.
As I said, you should use for each... like this:

And, if you make a list, there is no need to set it to an empty list first.
Cheers, Ghica.

Niclas Team

unread,
Jan 14, 2016, 10:34:17 AM1/14/16
to MIT App Inventor Forum
Thank you it works :-)
Reply all
Reply to author
Forward
0 new messages