XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently May 1st, 2025, 1:09 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: December 19th, 2018, 3:44 am 
Offline

Joined: September 7th, 2014, 1:23 am
Posts: 13
Hi,

Text should say good morning, good evening, good afternoon
but how? :D

that's what i found out

if (curHr < 12) {
console.log('good morning')
} else if (curHr < 18) {
console.log('good afternoon')
} else {
console.log('good evening')
}

how can I integrate this here and relode it every hour

function widgetOnLoad()
{
text1.text =
}

Thank for Help

PS. is there any Documentation for the funktions
example
text1.text = ?

Thanks Again ;)


Top
 Profile  
 
PostPosted: December 20th, 2018, 1:02 am 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
Hi!
You can use two ways:
1 way = java script
Took it as example from here:
https://www.deviantart.com/jimking/art/ ... -365686066
create 3 texts:
text1 = good morning
text2 = good evening
text3 = good afternoon
and add this js as base (this is for two components)

Code:
function datetimecore1OnUpdate(Sender)
{
    var mydate = new Date();
    var h = mydate.getHours();
    if(h>19||h<6) //night
    {
       text1.visible = true;
       text2.visible = false:
    }
    else          //day  6:00~20:00
    {
       text1.visible = false;
       text2.visible = true;
    }
}


or modifying this kind of js:
https://www.deviantart.com/jimking/art/ ... -370894930

or create 3 pngs with these words and add 24 images in a folder, and rename the corrisponding image to an hour 1,2,3,4....23
so create "good morning" image with name 7,8,9,10,11,12,13,14,15 etc

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


Top
 Profile  
 
PostPosted: December 21st, 2018, 1:54 am 
Offline

Joined: September 7th, 2014, 1:23 am
Posts: 13
Thank for you anwser i will try it ;)


Top
 Profile  
 
PostPosted: January 2nd, 2019, 4:33 am 
Offline

Joined: September 7th, 2014, 1:23 am
Posts: 13
Hi,

i used this, and it looks like it works


function datetimecore1OnUpdate(Sender)
{
var mydate = new Date();
var curHr = mydate.getHours();
if(curHr<12) //morning
{
morning.visible = true;
evening.visible = false;
afternoon.visible = false;
hello.visible = false;
}
else if(curHr<16) //Hallo
{
morning.visible = false;
evening.visible = false;
afternoon.visible = false;
hello.visible = true;
}
else if(curHr<18) //evening
{
morning.visible = false;
evening.visible = true;
afternoon.visible = false;
hello.visible = false;
}
else //afternoon
{
morning.visible = false;
evening.visible = false;
afternoon.visible = true;
hello.visible = false;
}
}

any objections or suggestions for improvement.
Thanks


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 5 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