[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Graphic Delay

Posted on 1998-04-14
2
Medium Priority
?
175 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 150 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

834 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