Solved

Graphic Delay

Posted on 1998-04-14
2
164 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

696 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