Do While Prevents Timer

Please report bugs.

Do While Prevents Timer

Postby Slowdown » Thu Jun 14, 2012 6:51 pm

Some simpel code,
Code: Select all
Event Init()
  Tm1.Interval = 1000
  Tm1.Enabled = True
  Tm1.Stop()
  doDelay = True
  MyDelay = 5
  Tm1.Start()
  Do While doDelay = True
    stdout("nothing " & String(DelaySeconds))
  Loop
  MsgBox("ready waiting")

The Timer Event,
Code: Select all
Signal on_Tm1_Event()
  DelaySeconds = DelaySeconds + 1
stdout(DelaySeconds)
  If DelaySeconds = MyDelay Then
    doDelay = False
  End If
End Signal

The Do While Loop is preventing that the Timer Event is called.
stdout(DelaySeconds) show no output until you disable the Do While Loop.
Kind regards,
Slowdown

OSX 10.8.x, VBox Xp, Ubuntu 32/64 bit, EOS 64 bit
Slowdown
 
Posts: 465
Joined: Sat May 01, 2010 7:11 pm
Location: Netherlands

Re: Do While Prevents Timer

Postby Henning » Thu Jun 14, 2012 8:37 pm

Add a DoEvents() in the loop, or the loop will not allow other things to run and the Form will freeze.

/Henning
Henning
 
Posts: 523
Joined: Fri Aug 13, 2010 6:29 pm

Re: Do While Prevents Timer

Postby Slowdown » Fri Jun 15, 2012 12:22 pm

Yup already did that but i thought that the Timer Event always was triggered.
How are you doing ?
Kind regards,
Slowdown

OSX 10.8.x, VBox Xp, Ubuntu 32/64 bit, EOS 64 bit
Slowdown
 
Posts: 465
Joined: Sat May 01, 2010 7:11 pm
Location: Netherlands

Re: Do While Prevents Timer

Postby Henning » Fri Jun 15, 2012 1:04 pm

I have this in Global, Timer1 is set to 1 second.
Code: Select all
Signal on_Timer1_Event()
  If TimeOut > 0 Then
    TimeOut = TimeOut - 1
  End If
'  Timer1.Enabled = False
End Signal


And this in a Module waiting for a UDP packet max 10 seconds.
Code: Select all
    TimeOut = 10
    Do
      If Len(lanBuf) > 17 Then
        Break
      End If
      DoEvents()
    Loop While TimeOut > 0 '** While Timer < TimeOut 'uBaseConn


/Henning
Henning
 
Posts: 523
Joined: Fri Aug 13, 2010 6:29 pm

Re: Do While Prevents Timer

Postby Slowdown » Fri Jun 15, 2012 1:42 pm

:D
I meant are you recovering from 'the one wrong click'
But thanks.
Kind regards,
Slowdown

OSX 10.8.x, VBox Xp, Ubuntu 32/64 bit, EOS 64 bit
Slowdown
 
Posts: 465
Joined: Sat May 01, 2010 7:11 pm
Location: Netherlands

Re: Do While Prevents Timer

Postby Henning » Fri Jun 15, 2012 1:58 pm

A little weird in my head... :roll:

Recovered no, but I have accepted that speed kills...

/Henning
Henning
 
Posts: 523
Joined: Fri Aug 13, 2010 6:29 pm


Return to Bug Reports

Who is online

Users browsing this forum: No registered users and 1 guest

cron