every so-many seconds execute? 
Author Message
 every so-many seconds execute?

I'm building a little app that displays pictures downloaded with http.
I've made an checkbox and a editfield, and now I would like to create
some code which does:

1. check if the checkbox is on
2. if it's on
3. check the value (a number, representing seconds) of the editfield
4. excecute some code (eg reload the picture) every so-many seconds

Is there a simple way to do this?

Joop



Fri, 01 Nov 2002 03:00:00 GMT  
 every so-many seconds execute?

Quote:
>I'm building a little app that displays pictures downloaded with http.
>I've made an checkbox and a editfield, and now I would like to create
>some code which does:

>1. check if the checkbox is on
>2. if it's on
>3. check the value (a number, representing seconds) of the editfield
>4. excecute some code (eg reload the picture) every so-many seconds

>Is there a simple way to do this?

Yep.

if checkbox.value=true then
timer.period = val(editfield.text)
timer.mode = 2
end if

Now put this code in whereever you want it executed and then put your picture
reload code in the timer.

-Nick Vellios

http://www.squirrelsw.com

Visual MacStandardBasic - Quick, fast, efficient Visual Development tool.  Get
your copy today!  www.macstandardbasic.com



Fri, 01 Nov 2002 03:00:00 GMT  
 every so-many seconds execute?

Nick Vellios schrieb:

Quote:

> Yep.

> if checkbox.value=true then
> timer.period = val(editfield.text)
> timer.mode = 2
> end if

Attention:
timer.periode=val(editfield.text) means that you have to enter the ticks in
editfield.text . One minute has 3600 ticks.

Greetings
Jens



Fri, 01 Nov 2002 03:00:00 GMT  
 every so-many seconds execute?

Quote:

> Nick Vellios schrieb:

> > Yep.

> > if checkbox.value=true then
> > timer.period = val(editfield.text)
> > timer.mode = 2
> > end if

> Attention:
> timer.periode=val(editfield.text) means that you have to enter the ticks
> in
> editfield.text . One minute has 3600 ticks.

> Greetings
> Jens

Timer periods are specified in milliseconds, not ticks, so you would
have to do val(editfield.text)/1000 to get seconds.

-endian



Fri, 01 Nov 2002 03:00:00 GMT  
 every so-many seconds execute?

Quote:

> Nick Vellios schrieb:
> > Yep.

> > if checkbox.value=true then
> > timer.period = val(editfield.text)
> > timer.mode = 2
> > end if
> Attention:
> timer.periode=val(editfield.text) means that you have to enter the ticks in
> editfield.text . One minute has 3600 ticks.

thanks alot, that worked. I've made the editfield hidden with default
value 30000. It reloads now (approx.) every 30 secs. It would be better if
the user could put in another value in seconds, but hey, I asked for
simple. :)
Joop


Sat, 02 Nov 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Executing Instruction once every second

2. update every second or every resched()?

3. view data continuously but only record every x seconds

4. How to update a texture every second?

5. script for every few seconds

6. Every 10 seconds?

7. Running a proc once every n seconds

8. execute code every set time

9. Execute code after every tcl command?

10. How can i execute a proc every x seconds?

11. Ada as a Second Language (second edition)

12. Second CFP: Workshop on Deductive Databases at JICSLP'92 Second Call for Participation

 

 
Powered by phpBB® Forum Software