Jump to content
xisto Community
ikkeugh

Button With Secconds

Recommended Posts

I've got a question : How do u make those buttons that countdown :if you don't press a button in (ex) 5 seconds , that that button will be chosen?(like the one of windows if you don't have a legal version 8-) )

Share this post


Link to post
Share on other sites

I've got a question : How do u make those buttons that countdown :
if you don't press a button in (ex) 5 seconds , that that button will be chosen?
(like the one of windows if you don't have a legal version 8-) )


You didn't mention about what programming language you're using. And i never since a windows that mention you don't have a legal version. I do see auto close windows for AVG auto update.

Generally, for windows, you can just start a timer with 1 second interval, along when you popup the windows, then update the the button showing a countdown on the button's text, on every tick of the timer. Keep static counter or a class wise variable for that purpose. When the counter tick to 0, close the window

Share this post


Link to post
Share on other sites

You didn't mention about what programming language you're using. And i never since a windows that mention you don't have a legal version. I do see auto close windows for AVG auto update.
Generally, for windows, you can just start a timer with 1 second interval, along when you popup the windows, then update the the button showing a countdown on the button's text, on every tick of the timer. Keep static counter or a class wise variable for that purpose. When the counter tick to 0, close the window

or for another exemple hitman pro ....
(windows : https://blog.codinghorror.com/ , you have to wait 5 seconds before you can hit it .) (i thinks you can also do this after 5 seconds it does it )

Share this post


Link to post
Share on other sites

You still didn't mention which language you are coding in.

But basically all you need to do is have a timer counting each second, and as each time the timer fires, take 1 off the time. When the value equals 0 then then stop the timber and enable the button.
-jimmy

In VB.NET

Timer_Tick	Do Until Count  = 0		 Count &= -1	Loop	'enable button nowEnd Timer

Edited by Jimmy89 (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.