[Gambas-user] Empty While loop question

nando nando_f at ...951...
Wed Apr 20 06:37:49 CEST 2005


Thank you.

VB has the same problem.
If I need to do pure processing of data for a extended period of time,
then while the code is running, the timer would never fire.

Question. Since this is the case, would the timer actually 
fire the timer event after an extended period of
processing data if the WAIT command happened much later in time 
after the actual delay of the timer was expired?

<code fragment>
...
Timer1.Delay = 1000
Timer1.Enable = True

WHILE processing_data=TRUE
  <process data - which takes a very long time>
WEND
...

PUBLIC Sub Timer1_Timer()
  TextBox1.Text = Current_time 'update time in a textbox
END
<end fragment>

...The time will never update and processing cannot be as fast as possible

I think it would be nice if the timer fired after the delay
regardless of what other code is doing.

Sincerely,
-Fernando



---------- Original Message -----------
From: Pablo Vera <pvera at ...729...>
To: gambas-user at lists.sourceforge.net
Sent: Tue, 19 Apr 2005 23:14:58 -0500
Subject: Re: [Gambas-user] Empty While loop question

> The problem is that the WHILE-WEND loop runs continously and doesn't 
> allow the event to fire.
> 
> You need something like this:
> 
>    WHILE  Timer1.Enabled = True         'wait here until timer completes
>      WAIT 0.1                           'allow events to fire
>    WEND
> 
> But if you need to wait a specified amount of time, simply use the 
> WAIT command like this:
> 
>    WAIT n
> 
> where n is the amount of time in seconds that the program should wait.
> 
> Saludos,
> Pablo Vera
> 
> nando wrote:
> > Question...
> > Assume there is a timer on the form
> > and the following 3-line code fragment is running
> > (which is NOT inside the timer sub)
> > 
> > ...
> > Timer1.Enabled = True
> > WHILE  Timer1.Enabled = True         'wait here until timer completes
> > WEND
> > ...
> > 
> > Public Sub Timer1_Timer
> > 
> >   Timer1.Enable = False
> > 
> > End Sub
> > 
> > 
> > The purpose is to wait a prescribed amount of time, which the
> > timer is used for, at which time the timer is disabled and
> > the program continues.
> > 
> > Question: Why does the timer event not actually fire??
> > -Fernando
> > 
> > 
> > 
> > 
> > -------------------------------------------------------
> > This SF.Net email is sponsored by: New Crystal Reports XI.
> > Version 11 adds new functionality designed to reduce time involved in
> > creating, integrating, and deploying reporting solutions. Free runtime info,
> > new features, or free trial, at: http://www.businessobjects.com/devxi/728
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> > 
> > 
> >
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: New Crystal Reports XI.
> Version 11 adds new functionality designed to reduce time involved in
> creating, integrating, and deploying reporting solutions. Free 
> runtime info, new features, or free trial, at:
http://www.businessobjects.com/devxi/728
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
------- End of Original Message -------





More information about the User mailing list