XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently May 8th, 2025, 6:07 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: November 1st, 2013, 12:05 pm 
Offline

Joined: March 4th, 2013, 9:38 pm
Posts: 17
I have created a weather widget, which uses the component "Memo".
In my script I'm filtering scraped data (from a weather-warnings webpage) and fill my "MemoMsg.Text" with it.
Everything is working fine, but XWidget is breaking the words apart - instead of breaking it before.

Example:
This is a weather warning for reg
ion
xy, last update on 1. Novemb
er
2013 ...


Shouldn't break a "word-wrap" the lines before/after a word :?:
(attributes "WordWrap" and "Readonly" are set to "True" for that control - in the GUI and in the code too)


And I am facing another little problem using DateTimeCore.
I put a code like the following in my script and set Refresh Intervall > 1950 ms - in fact I use "1 Minute" (=60000 ms):
Code:
var cr_time;
cr_time = datetimecore1.Get("${Time}");
print("cr_time: >" + cr_time + "<");
Nearly everytime I'm getting an empty value for cr_time when I start the widget (but not always!). Why - anything wrong with it?
This kind of code is used for deciding which background to show (calculating/comparing it with sunrise/sunset of AccWeatherCore -> day/night).
In my thoughts DateTimeCore gets initialized at startup (keeps its records) and refreshes its data (after the intervall timer) but maybe that is a misunderstanding :?:
(at least something seems to change if Intervall is set to "1951 ms" or more).

Kind regards


Top
 Profile  
 
PostPosted: November 1st, 2013, 7:47 pm 
Offline

Joined: June 18th, 2012, 12:07 am
Posts: 268
Quote:
Nearly everytime I'm getting an empty value for cr_time when I start the widget
I can not simulate your problem, stopped and started widget more that 20 times, worked every time.

function datetimecore1OnUpdate(Sender) // triggered every 60000ms
{
var cr_time = datetimecore1.Get("${Time}");
alert ("cr_time: >" + cr_time + "<"); // or // print("cr_time: >" + cr_time + "<");
}


Top
 Profile  
 
PostPosted: November 1st, 2013, 9:28 pm 
Offline

Joined: March 4th, 2013, 9:38 pm
Posts: 17
Thanks meme,

that's a bit strange. Do you run other widgets using datetimecore same time?


Top
 Profile  
 
PostPosted: November 3rd, 2013, 11:43 pm 
Offline
User avatar

Joined: March 8th, 2013, 10:27 pm
Posts: 353
You should not use the datetimecore to get the current time. Cores only work after the entire widget is loaded (though the behavior appears to be changed in later versions)
use this:
var date = new Date(); //store it as a global value()

function mytask()
{
int hrs = date.getHours(); //hours
int mins = date.getMinutes(); //hours
int secs = date.getSeconds(); //hours
}

_________________
Life is a myriad game... Just play it!


Top
 Profile  
 
PostPosted: November 4th, 2013, 12:33 am 
Offline

Joined: June 18th, 2012, 12:07 am
Posts: 268
I agree with you digigamer...
but should it work OK because the function datetimecore1OnUpdate(Sender) and the code it contains, is not executed until after the core has updated, example triggered every 60000ms only after update, same at startup only after update ?


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

All times are UTC - 8 hours


Who is online

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