Monday, November 26, 2018

Create Timer on button click

function timerFunc(){
  var da = new Date();
  frmProfile.lblDatetimeshow.text = da.toLocaleTimeString();
}

var INtrue = false;

function itimerStart() //nested function
{
  var d = new Date();
  if(INtrue === false){
    frmProfile.LblDateIn.text ="";
    frmProfile.LblDateIn.text = d.toDateString();
    frmProfile.lblStatusshow.text ="IN";
    frmProfile.LblIntime.text ="IN:";
    frmProfile.LblIntime.text = "IN:" + d.toLocaleTimeString();
    frmProfile.LblOuttime.text ="OUT:";
    INtrue = true;
    frmProfile.imgProgressstatus.setVisibility(true);
  }else if (INtrue === true) {
    frmProfile.LblDateIn.text ="";
    frmProfile.LblDateIn.text = d.toDateString();
    frmProfile.LblOuttime.text ="OUT:";
    frmProfile.LblOuttime.text = "OUT:" + d.toLocaleTimeString();
    frmProfile.imgProgressstatus.setVisibility(false);
    frmProfile.lblStatusshow.text ="OUT";
    INtrue = false;
  }
}
kony.timer.schedule("",timerFunc, 1, true);

0 comments:

Post a Comment