XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently April 22nd, 2025, 12:46 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: August 20th, 2019, 3:17 pm 
Offline

Joined: May 16th, 2019, 5:52 pm
Posts: 8
Hi, As the subject says, I want to run a loop in the WidgetOnLoad function to change text colors, adding a numerical
variable to the text name. (IE: "text" + i + ".font.fill.color = TextColor1"), where 1 is added to i at the end of each loop.

I can do the code for the loop but when appending the variable it doesn't change the text colors. Is there a way to do this?
What command(s) do I need to make it work? Code I have tried is below.

The text components are named": text1, text2 etc. up to text15.
Code:
//   Color Variables
var TextColor1 = rgba(0,130,230,255);
var BorderColor = rgba(0,60,100,255);
var BackColor = rgba(0,0,0,127);
var LineColor = rgba(0,44,80,255);

function widgetOnLoad()
{
i=1
     while(i <=15)
     {
     "text" + i + ".font.fill.color = TextColor1";
     i++;
     }
}

I also tried:
Code:
eval("text" + i + ".font.fill.color = TextColor1");

and:
Code:
do{
"text" + i + ".font.fill.color = TextColor1";
}

I can see that I get the correct strings from the code loop but it doesn't change the text colors?

I have a text launcher with 75 different text components and I'd rather not have to add them all one by one if I don't have to.

If not, is there a way to have different widgets use the same variables?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron

Powered by phpBB® Forum Software © phpBB Group