XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently May 10th, 2025, 9:31 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: April 19th, 2014, 8:07 am 
Offline
User avatar

Joined: April 6th, 2014, 5:20 am
Posts: 24
Let's say I have one text area, and I want to show Weather in it, then have the weather vanish and an RSS feed show up instead. And I want it to loop between these two things. Right now I'm trying this code:

Code:

talklayer.Visible=true; //is the text area  supposed to be visible?

function hideInfo() // hides both the weather info and RSS info layers
{
Weather_Info.Visible = false;
RSSText1.Visible = false;
}

function exchanger()   // called at widget load
{

while (talklayer.Visible==true)   //is the text area visible to the user
{
hideInfo();                                              // empty the text area
RSSText1.Visible = true;                        //show me the RSS feed text
sleep(1500);                                         //leave it up for a while
hideInfo();                                            // hide  all text
Weather_Info.Visible = true;                //Show me the Weather text now
hideInfo();                                          //hide all the text
sleep(1500);                                      //wait, repeat on loop
 }

}

My problem is using this code both layers show up simultaneously and they won't turn off. Am I doing something wrong? Is there a better way to rotate between text layers?



Top
 Profile  
 
PostPosted: April 19th, 2014, 9:04 am 
Offline
User avatar

Joined: June 10th, 2012, 5:57 am
Posts: 313
1. it's better to use while(talklayer.visible) than while(talklayer.visible==true)
2. I think that it's dangerous to combine while and sleep especially when you call them at widget load.
3. my solution:
use a timercore whose interval is 1500 ms to exchange weather and rss.
Code:
function timercore1OnUpdate(Sender)
{
  if(talklayer.Visible)
  {
    Weather_Info.Visible = !Weather_Info.Visible;
    RSSText1.Visible = !RSSText1.Visible;
  }
}


Top
 Profile  
 
PostPosted: April 19th, 2014, 9:24 am 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
This is the "magic" with the script: you can do the same thing with only two lines of coding!!! :lol:

_________________
...and remember: don't take life too seriously...
My profile on Deviantart: http://jimking.deviantart.com/


Top
 Profile  
 
PostPosted: April 19th, 2014, 12:13 pm 
Offline
User avatar

Joined: April 6th, 2014, 5:20 am
Posts: 24
Thanks for all the help! :D


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

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 20 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:  

Powered by phpBB® Forum Software © phpBB Group