How do I prevent moving text from blinking? (Timer interval = 10)

MyTech

Access VBA
Local time
Today, 02:11
Joined
Jun 10, 2010
Messages
108
I have labels moving up in my project set by the forms' "On Timer" event.

When I set the "Timer Interval" to "10", the moving text is slightly blinking (like if it didn't have enough time to set itself before preparing to go to next position).

What do I have to do? Do I need a quicker monitor maybe?


Code:
Private Sub Form_Timer()

    If Label2.Top < 100 Then
        Label2.Top = 5000
    End If
    Label2.Top = Label2.Top - 20


    If Label3.Top < 100 Then
        Me!Label3.Top = 5000
    End If
    Label3.Top = Label3.Top - 20

End Sub
 
At the end try adding:

Code:
Me.Repaint

If that does not work also add

Code:
DoEvents
 
Repaint just slows down the process,
DoEvents appears to not do any change.



Attached is a short video where you can see the moving text is flickering.


Timer interval = 10.

Form_OnTimer =
Code:
Private Sub Form_Timer()

If Label2.Top < 100 Then
    Me!Label2.Top = 10000
End If
Me!Label2.Top = Label2.Top - 20

End Sub
 

Attachments

Why in the world would you have the timer interval set at 10?

10 milliseconds is way too often to be checking this code. What is the purpose of this (sorry, I can't download a video at work).
 
The purpose is to have notification textboxes moving up.

Let's say showtimes.

"Showtimes start at

10:00
10:30
11:10
11:50
12:25
1:00"

etc.

I'm planning to use code to also make the upcoming showtime textbox should start blinking 15 minutes prior to the show start time.


Edit: If I set the interval higher than 10, I feel like the text doesn't move smooth enough.
 
10 milliseconds is still too fast. The human mind can't process that fast. Why not use 1000 milliseconds (which is 1 second) and see how that works for you.
 
So as you've already been told 10 is too small so a second (i.e. 1000) "should" be than sufficient.
 
try a different effrect - what about changing the label colour, or cycling the text size. that might look cleaner than the "flickering" of screen repaints.Maybe it's the movement of 20 pixels thats the problem. Try with a smaller value.


alternatively, maybe you need to look at sprite animation techniques, to handle a moving graphic.

eg - this made me smile, although I am not sure how relevant it is. Interesting discussion though.

http://www.manningkrull.com/pixel_art/tutorials/walking.asp
 
Last edited:
I guess I have to give up on having smooth moving text. I'll either set the interval to a couple of hundreds or alternate my design ideas.

I attached here an .mdb (2000) example of how it would look in intervals 10, 20, 50, 100, 500 and 1000, where you can see that '10' is the smoothest but flickers the most and worst in catching up with the speed, and '500' Does not flicker and runs at right speed but is unpleasant to watch.

Thank you guys for your replies.
 

Attachments

i had a play with it - but i can't stop the occasional flickering

i am not sure how to resolve it at all.

it's probably something to do with the way access actually draws objects on the screen
 

Users who are viewing this thread

Back
Top Bottom