XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently 2018年 Jan 17日 19:41

All times are UTC - 8 hours




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Countdown Timer
PostPosted: 2017年 Jun 24日 08:33 
Offline

Joined: 2015年 Jan 3日 06:48
Posts: 14
Hi i wants to make a timer where i can type 3.00.0 and it wil go dow to zero and go back to 2.59.59

and a start and stop buttom can anybody help


/Stonie


Top
 Profile  
 
 Post subject: Re: Countdown Timer
PostPosted: 2017年 Jun 24日 11:24 
Offline
User avatar

Joined: 2012年 Dec 5日 17:52
Posts: 4581
Stonie if I remember well there is a timer widget posted on DA. I don't know if you can find any similar one in the official gallery. I will search and if I find something I will post the link here

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


Top
 Profile  
 
 Post subject: Re: Countdown Timer
PostPosted: 2017年 Jun 25日 11:56 
Offline

Joined: 2015年 Jan 3日 06:48
Posts: 14
Thx Jimking


Top
 Profile  
 
 Post subject: Re: Countdown Timer
PostPosted: 2017年 Jun 25日 13:49 
Offline
User avatar

Joined: 2012年 Dec 5日 17:52
Posts: 4581
I found this for now:
http://www.kuyuapp.com/xwidget/widgets/ ... 18/52.html
It's a Countdown Timer widget but for days only..
Send a pm to this guy and ask if he knows something..
http://kjc66.deviantart.com/

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


Top
 Profile  
 
 Post subject: Re: Countdown Timer
PostPosted: 2017年 Jun 26日 12:08 
Offline

Joined: 2015年 Jan 3日 06:48
Posts: 14
thx and i will


Top
 Profile  
 
 Post subject: Re: Countdown Timer
PostPosted: 2017年 Jun 27日 23:39 
Offline
User avatar

Joined: 2013年 Mar 8日 22:27
Posts: 357
Code:

var Countdown = new function(mins, seconds, done) {
   this.timeLeft = mins * 60 + seconds;
   this.done = done;
}

Countdown.prototype.start = function () {
   var self = this;
   var down = function () {
       this.countdown--;
       if(self.timeLeft > 0) {
           self.counter = setTimeout(down, 1000);
       } else {
           self.done();
       }
   };
}

Countdown.prototype.pause = function () {
    if ( this.counter) {
        clearTimeout(this.counter); 
    }
}

Countdown.prototype.reset = function () {
    this.timeLeft = 0;
    if ( this.counter) {
        clearTimeout(this.counter); 
    }
}



Use it like this:

Code:
// global
var c;

// in widget create
var c = new Countdown(minutes, seconds);

// on start
c.start();

// pause
c.pause();

//reset
c.reset();

// on stop

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


Top
 Profile  
 
 Post subject: Re: Countdown Timer
PostPosted: 2017年 Jun 28日 00:16 
Online
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 572
Steady on Digigamer, or people will start to use Xwidget for real javascript development!

:)


Top
 Profile  
 
 Post subject: Re: Countdown Timer
PostPosted: 2017年 Jun 28日 10:11 
Offline

Joined: 2015年 Jan 3日 06:48
Posts: 14
Thx alot

it runs but how can i make a display for the counter to show numbers sorry for being a noob :)


Last edited by Stoniee on 2017年 Jun 28日 10:23, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Countdown Timer
PostPosted: 2017年 Jun 28日 10:22 
Online
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 572
Well dear chap, as this is a javascript engine it will be hard to answer your queries without some relation to javascript.

https://stackoverflow.com/questions/20618355/the-simplest-possible-javascript-countdown-timer

Digigamer's answer and the above link is the sort of answer you will receive here. Both replies would assist us. Bar us creating a widget for you your only recourse is to search through the widgets that exists in the gallery and look for one that fits, then look into making changes so it will do what you want.


Top
 Profile  
 
 Post subject: Re: Countdown Timer
PostPosted: 2017年 Jun 28日 10:27 
Offline

Joined: 2015年 Jan 3日 06:48
Posts: 14
ahh okay so i guess this is the wrong place to get help for understanding the script

sorry im a noob


Top
 Profile  
 
 Post subject: Re: Countdown Timer
PostPosted: 2017年 Jun 28日 11:34 
Online
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 572
No, its the right place but the trouble is the answers might be a bit complex for you to take.

Find a countdown widget, see how it is built and get used to the idea of Xwidget cores and how they operate, then look at some widgets with javascript and see if you can get a handle on how it does what it does, I have a stopwatch widget that might be interesting but it could also overwhelm you.

http://yereverluvinuncleber.deviantart.com/art/Panzer-Clock-and-Stopwatch-XWidget-593451692

This programming stuff isn't easy and even though javascript/Xwidgets is at the easiest end of it, it still requires knowledge of xwidget cores or javascript techniques.


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

All times are UTC - 8 hours


Who is online

Users browsing this forum: Yahoo [Bot] and 9 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