picturebox control not fast enough? 
Author Message
 picturebox control not fast enough?

I have a label control on a form that acts as a status bar (displays
messages etc).  In order to avoid flicker I placed the label in a Picture
Box control.  This fixed the flicker problem, but whenever my code tries to
display a status message by changing the caption of the label, there is a
long delay before the message is displayed.  In fact, the message usually
shows up after the process in question has ended which is fairly useless.
The Label.Caption = "whatever" statement is also the first line of code to
be executed so I don't get why it takes so long to show up.

I also tried creating a timer control with a 100 interval and placing a
Picure.Refresh command in it's event, but VB says this method is not
supported by the Picture Box control.

Please help as the MS Knowledge Base coundn't....



Tue, 06 Nov 2001 03:00:00 GMT
 picturebox control not fast enough?

After you change the label's caption, issue a DoEvents.



Quote:
>I have a label control on a form that acts as a status bar (displays
>messages etc).  In order to avoid flicker I placed the label in a Picture
>Box control.  This fixed the flicker problem, but whenever my code tries to
>display a status message by changing the caption of the label, there is a
>long delay before the message is displayed.  In fact, the message usually
>shows up after the process in question has ended which is fairly useless.
>The Label.Caption = "whatever" statement is also the first line of code to
>be executed so I don't get why it takes so long to show up.

>I also tried creating a timer control with a 100 interval and placing a
>Picure.Refresh command in it's event, but VB says this method is not
>supported by the Picture Box control.

>Please help as the MS Knowledge Base coundn't....



Tue, 06 Nov 2001 03:00:00 GMT
 picturebox control not fast enough?
When you change the text in a label, you can't avoid some amount of
'flicker' due to the change taking place.  You can avoid flicker that
happens when you udate the label with the same contents it already holds.

If you only change the label in one spot then you can avoid the sub,
otherwise you might add this to your program:

Private Sub StatusDisplayUpdate(NewText$)
    If lblStatus <> NewText Then lblStatus = NewText: lblStatus.Refresh
End Sub

I prefer the refresh method over using DoEvents, when it is available...

LFS

Quote:

> I have a label control on a form that acts as a status bar (displays
> messages etc).  In order to avoid flicker I placed the label in a Picture
> Box control.  This fixed the flicker problem, but whenever my code tries to
> display a status message by changing the caption of the label, there is a
> long delay before the message is displayed.  In fact, the message usually
> shows up after the process in question has ended which is fairly useless.
> The Label.Caption = "whatever" statement is also the first line of code to
> be executed so I don't get why it takes so long to show up.

> I also tried creating a timer control with a 100 interval and placing a
> Picure.Refresh command in it's event, but VB says this method is not
> supported by the Picture Box control.

> Please help as the MS Knowledge Base coundn't....



Tue, 06 Nov 2001 03:00:00 GMT
 picturebox control not fast enough?
Just curious why the Refresh is necessary in some instance while not in
others.  In some circumstances setting the caption property takes effect
immediately while in others the Refresh method is required.  Is it because
the label control gets lower priority than other objects?


Tue, 06 Nov 2001 03:00:00 GMT
 picturebox control not fast enough?
Let me give you an example:

If you have a commandbutton with a click event like this:

    Private Sub Command1_Click()
        Label1.Caption = "Whatever..."
    End Sub

... refresh / doevents is not necessary since you pass control to the event
handling mechanism immediately after changing the caption property (at the
end sub statement). If, instead, the click event is something like this:

    Private Sub Command1_Click()
        Label1.Caption = "Working very hard..."
        For x = 1 to 1000000
            'Doing some work...
        Next x
    End Sub

... then you won't be passing control to the event handling mechanism until
the sub ends (after the huge loop). To get the caption updated before the
end sub statement, you will need to either refresh the label, or manually
pass control to the event handling mechanism by issuing a DoEvents call.

Hope this makes sense to you...



Quote:
> Just curious why the Refresh is necessary in some instance while not in
> others.  In some circumstances setting the caption property takes effect
> immediately while in others the Refresh method is required.  Is it because
> the label control gets lower priority than other objects?



Sat, 10 Nov 2001 03:00:00 GMT
 
 [ 5 post ] 

 Relevant Pages 

1. Forms not updating fast enough?

2. ISDN Connection not fast enough?

3. CListCtrl is not fast enough!

4. Q+E not releasing fast enough

5. Binding a PictureBox Control

6. Graph resizes to fit a PictureBox Control

7. Displaying Access Bitmaps in A PictureBox Control Via ADO

8. Databound Image Control or PictureBox

9. Picturebox / Image control

10. picturebox with then ADO-Control

11. loading image or picturebox control from access 3.0 db w/ DAO

12. Controls Into PictureBox No Longer Work????


 
Powered by phpBB® Forum Software