Solved

Graphic Delay

Posted on 1998-04-14
2
160 Views
Last Modified: 2010-05-18
I want it to take five seconds for the circle to evaporate. In other words: I am trying to graphically represent a 5-second delay in the program, from one message box to another message box. What am I doing wrong?

Option Explicit
Dim Pausetime, Start, Finish, TotalTime


Private Sub Command1_Click()
If (MsgBox("Press Yes to pause for 5 seconds", 4)) = vbYes Then
      Pausetime = 5
      Start = Timer
      Do While Timer < Start + Pausetime
            DoEvents
            Timer1_Timer
      Loop
      Finish = Timer
      TotalTime = Finish - Start
      MsgBox "Paused for " & TotalTime & " seconds"
Else
      End
End If
End Sub

Private Sub Timer1_Timer()
Cls
Dim x As Integer
Dim y As Integer
Dim Radius As Integer
Const PI = 3.14159265
Static num As Double
FillColor = QBColor(4)
FillStyle = 0
x = ScaleWidth / 2
y = ScaleHeight / 2
Radius = ScaleWidth / 4
Circle (x, y), Radius, , num, -6.283
num = num - ((2 * PI) / 60)
Text1.Text = Str$(num)
If Abs(num) >= 6.283 Then
      num = 0
      Timer1.Enabled = 0
      Cls
End If

End Sub
0
Comment
Question by:MarkW
  • 2
2 Comments
 
LVL 18

Expert Comment

by:deighton
ID: 1461242
You seem to be calling the timer event explicitly from within the while loop.  Although the while loop will iterate for 5 seconds I would expect to see the circle vanish in much less time. Is this right ?
Perhaps you need to remove the timer_timer1 call from your while loop and set the timer interval to an appropriate value so that the event is called just enough times to wipe out the circle.
0
 
LVL 18

Accepted Solution

by:
deighton earned 50 total points
ID: 1461243
OK how about this

Private Sub Draw_circle()
    Cls
    Dim x As Integer
    Dim y As Integer
    Dim Radius As Integer
    Const PI = 3.14159265

    FillColor = QBColor(4)
    FillStyle = 0
    x = ScaleWidth / 2
    y = ScaleHeight / 2
    Radius = ScaleWidth / 4
    Circle (x, y), Radius, , num, -6.283
'    num = num - ((2 * PI) / 60)
    Text1.Text = Str$(num)
    If Abs(num) >= 6.283 Then
          num = 0
 '         Timer1.Enabled = 0
          Cls
    End If

End Sub



0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now