XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently 2017年 Apr 29日 13:29

All times are UTC - 8 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: 2014年 Apr 19日 08:07 
Offline
User avatar

Joined: 2014年 Apr 6日 05:20
Posts: 23
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: 2014年 Apr 19日 09:04 
Offline
User avatar

Joined: 2012年 Jun 10日 05:57
Posts: 315
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: 2014年 Apr 19日 09:24 
Offline
User avatar

Joined: 2012年 Dec 5日 17:52
Posts: 4405
This is the "magic" with the script: you can do the same thing with only two lines of coding!!! :lol:

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


Top
 Profile  
 
PostPosted: 2014年 Apr 19日 12:13 
Offline
User avatar

Joined: 2014年 Apr 6日 05:20
Posts: 23
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: Yahoo [Bot] and 1 guest


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