Control 'Flickering' Problem (1 Viewer)

Martin Beney

Registered User.
Local time
Today, 19:12
Joined
Mar 22, 2007
Messages
27
Hi,
VBA Access 2019

I want a set of thumbnails displayed with text underneath and for the one under the mouse to be highlighted.

I have an unassociated label (I have tried a text box etc with no change) which holds the text and I change the background colour using mouse move etc. Over the top of this is a smaller image control for the thumbnail.

It all works except....
when changing the background colour of the label it seems that the picture is repainted as well and this makes it look significantly ugly!

I have tried docmd.echo false, application.echo false and me.paint false. NONE stop the picture blanking and then repainting.

SO how to stop the screen display until it is all complete?

Any ideas gratefully received.

Regards Martin
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:42
Joined
May 7, 2009
Messages
19,230
make sure the Picture and Label don't Overlap.
 

Martin Beney

Registered User.
Local time
Today, 19:12
Joined
Mar 22, 2007
Messages
27
Sorry - read the description.
The label is there to highlight which picture (in an array of thumbs) you are hovering over - like file explorer does!!!
 

isladogs

MVP / VIP
Local time
Today, 14:42
Joined
Jan 14, 2017
Messages
18,211
Unattached labels used to cause issues in earlier versions of Access though largely solved now.
Mouse move events will cause repeated refreshes unless you turn off screen updating or disable the code once the mouse move event is triggered.
And as arnelgp stated, avoid having overlapping controls.

It is solvable. See if this link helps Move Forms & Controls - Mendip Data Systems. The relevant part is Form 5.
Or perhaps this utility Folder Image Viewer - Mendip Data Systems
 

Martin Beney

Registered User.
Local time
Today, 19:12
Joined
Mar 22, 2007
Messages
27
Anyone any idea why turning off echo and painting doesn't work - anyone any work around?
 

isladogs

MVP / VIP
Local time
Today, 14:42
Joined
Jan 14, 2017
Messages
18,211
They both work normally but MouseMove events can be tricky as you are continuing to trigger the event with any miniscule movement even if too small to be seen by eye. As already stated, you may need to disable the event completely once triggered.

BTW Application.Echo=False stops all screen updating whereas Me.Painting= False only applies to that object
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 14:42
Joined
Sep 12, 2006
Messages
15,650
One fix was to change the label to an unbound text box, with locked = true, enabled = false, then it looks and behaves just like a label.

make the value ="Some Caption"
It needs the equal sign.
 

Martin Beney

Registered User.
Local time
Today, 19:12
Joined
Mar 22, 2007
Messages
27
Hi isladogs,
I know the documentation says App.echo=false stops ALL screen painting but it does not! Changing the background colour of a label behind an image causes the image to repaint/reload (not sure which) and this is visible even with echo off!!!

All I need is a way to turn painting off but for this combination I can't find a way...

My suspicion is that because access does not handle the screen like most programs (separate objects). It HAS to repaint each layer and that's the basic problem. But turning painting off should still stop you seeing it - it doesn't damn it.
 

Martin Beney

Registered User.
Local time
Today, 19:12
Joined
Mar 22, 2007
Messages
27
Hi gemma-the-husky,
Just to let you know I tried the text box idea but when locked and not enabled the mouse events don't fire (of course, its not enabled) so that ones out too.
 

Minty

AWF VIP
Local time
Today, 14:42
Joined
Jul 26, 2013
Messages
10,371
In your mouse move code, check that the setting (colour?) you have set needs to be changed, and if not don't change anything.
This will prevent any unnecessary repainting being required.

If me.control.forecolor = 12345 then me.control.forecolor = 23456
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 14:42
Joined
Sep 12, 2006
Messages
15,650
Hi gemma-the-husky,
Just to let you know I tried the text box idea but when locked and not enabled the mouse events don't fire (of course, its not enabled) so that ones out too.

Do you need events on an unattached label?
 

isladogs

MVP / VIP
Local time
Today, 14:42
Joined
Jan 14, 2017
Messages
18,211
Martin
Have you looked at the code in form 5 (and form 4) of the first link I gave earlier Move Forms & Controls - Mendip Data Systems
The Mouse Move events include code to prevent (or at least minimise) screen flicker
Otherwise, @Minty's comment in post #11 describes what I referred to earlier about 'disabling' mouse move once the change has been made

If you're still stuck after that I suggest you upload a cut down version of your database so we can look at it and advise properly.
 

Babycat

Member
Local time
Today, 20:42
Joined
Mar 31, 2020
Messages
275
I had encountered with picture flickering issue. It was really anoying. I found a solution by changing the picture resolution to a lower value.
It was originally 24KB. I used picture tool in powerpoint, compact it to 96 ppi, its size downs to 6KB.
The flickering is totally gone.
Hope this help
 

Users who are viewing this thread

Top Bottom