XWidgetSoft Forum
https://www.bbs.xwidget.com/

[bug?] WordWrap splits inside words and DateTimeCore problem
https://www.bbs.xwidget.com/viewtopic.php?f=3&t=3723
Page 1 of 1

Author:  jackiDi [ November 1st, 2013, 12:05 pm ]
Post subject:  [bug?] WordWrap splits inside words and DateTimeCore problem

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

Author:  meme [ November 1st, 2013, 7:47 pm ]
Post subject:  Re: [bug?] WordWrap splits inside words and DateTimeCore pro

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 + "<");
}

Author:  jackiDi [ November 1st, 2013, 9:28 pm ]
Post subject:  Re: [bug?] WordWrap splits inside words and DateTimeCore pro

Thanks meme,

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

Author:  digigamer [ November 3rd, 2013, 11:43 pm ]
Post subject:  Re: [bug?] WordWrap splits inside words and DateTimeCore pro

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
}

Author:  meme [ November 4th, 2013, 12:33 am ]
Post subject:  Re: [bug?] WordWrap splits inside words and DateTimeCore pro

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 ?

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/