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

HELP: problem with alarm in the Time widget
https://www.bbs.xwidget.com/viewtopic.php?f=8&t=3922
Page 1 of 1

Author:  Oletik [ December 18th, 2013, 9:08 am ]
Post subject:  HELP: problem with alarm in the Time widget

Why when I enter a value in the edit field 08 or 09, the text displays 0 or 00? Other numbers are displayed normally. But if I enter only 8 or 9 (without 0 in front) all OK.
I do not understand where is the problem
Attachment:
preview.png
preview.png [ 36.29 KiB | Viewed 3997 times ]

My code:

function buttOKOnClick(Sender)
{
ah = parseInt(edit_h.Text);
text_h.text=ah;
if (ah>23)
{
timercore5.Enabled = true;
text_h.text="- ";
}
if (edit_h.Text=="")
{
timercore5.Enabled = true;
text_h.text="- ";
}
am = parseInt(edit_m.Text);
text_m.text=am;
if (am<10)
{
text_m.text=("0"+am);
}
if (am>59)
{
timercore5.Enabled = true;
text_m.text=" -";
}
if (edit_m.Text=="")
{
timercore5.Enabled = true;
text_m.text=" -";
}
timercore5.Enabled = true;
alarmTime.visible = true;
msg.visible = true;
memo.visible = false;
alarm.visible = false;
imAlarm.visible = true;
imAlarm1.visible = false;
}

function timercore5OnUpdate(Sender)
{
if (hours.text==ah)
{
if(minutes.text==am)
{
T23OnClick();
PlaySound("sound.wav");
time_Zone.visible = false;
bell_hourly.visible = false;
clock_calendar.visible = true;
alarmTime1.visible = true;
alarmTime.visible = false;
alarmTime1.InitAnimateChange;
alarmTime1.AnimateChange.Style = 21;
alarmTime1.StartAnimateChange;
edit_h.text="";
edit_m.text="";
text_h.text="";
text_m.text="";
text_h1.text=ah;
text_m1.text=am;
}
else
{
alarmTime1.visible = false;
}
}
}

Author:  qiancang [ December 18th, 2013, 5:56 pm ]
Post subject:  Re: HELP: problem with alarm in the Time widget

it's a problem of parseInt()

you should add its second parameter parseInt(edit_h.text,10)

parseint is a function of javascritp.you can get more details from google

Author:  Oletik [ December 19th, 2013, 9:46 am ]
Post subject:  Re: HELP: problem with alarm in the Time widget

Thank you, qiancang, for the help!!!
It work OK!
I never guessed about it without you.

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