Solved

Graphic Delay

Posted on 1998-04-14
2
159 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
Comment Utility
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
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

771 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

11 Experts available now in Live!

Get 1:1 Help Now