Application.Echo False causes more flicker

spikepl

Eledittingent Beliped
Local time
Today, 15:58
Joined
Nov 3, 2010
Messages
6,142
A2007

I have a flicker problem when running OoClick of a listbox. So I put Applicaiton.Echo False... and then the flicker turned much worse, because the entire screen aand all other controls flash!

Se attached db (newly minted) to illustrate, where the OnClick of the right listbox contains

Application.Echo False followed immediately by
Application.Echo True

the above has the opposite effect of tyhe one expected: setting it on False then True causes the other listbox to flicker!

1. click on left listbox - right list box does not flicker.
2. clik on right listbox - the left list box flicker occasionally.

What to do?
 

Attachments

I ran your application. Had to refresh my memory about the Applicaiton.Echo. Saw there was an option to update the Status bar with a message too.
Added the MSDN example below to remind myself what it is used for.
Ran your code. Added a debug halt at one point to verify the event code in list box 2 was in fact being called.
RESULT: The flicker was not there on about 9 out of 10 clicks as fast as they could be clicked.The 10th click (generally speaking, not an exact count) was so minor, I had to really watch for it.
It was hardly noticable.To make it slightly flicker, it usually required clicking from bottom to 2nd one down or skipping a row.
The UP/Down arrow in the list 2 box at rapid key-stroke never even had the minor flicker.
This is running on a Pentium Xeon 4th generation, 16 GB DDR (high speed) Dell Precision T1700 with a $450 list price graphics card (a few months old) ACCESS 2007 with all SP installed.
Code:
) Example shown at MSDNPublic 
Sub EchoOff() ' Open the Employees form minimized. 
Application.[B]Echo[/B] False 
DoCmd.Hourglass True 
DoCmd.OpenForm "Employees", acNormal DoCmd.Minimize 
Application.[B]Echo[/B] True
DoCmd.Hourglass FalseEnd Sub[CODE]
 

Attachments

  • flicker listbox.jpg
    flicker listbox.jpg
    16.5 KB · Views: 267
Last edited:
Thanks for the reply but it does not solve my problem.

The example I supplied is an emasculated version of a db with many controls among which 4 listboxes. There all the listboxes flicker when I run a OnClick, but when I use the Echo False and the Echo True after execution , the flickering gets even worse - the entire form flickers.

The above point is preserved in the example I supplied: flickering gets worse, not better, with Echo False.
 
http://www.access-programmers.co.uk/forums/showthread.php?t=172987
Interesting discussion, the last comment claims to mirror your desctiption.

The poster with the problem was going to try and importa all objects into a blank database as the soltuion. They never came back to say if it worked.
That is a reason, I often ask people to share a solution if it worked.

My customer does not allow an update button, but there is a lot of rules that enable and disable controls based on business rules. There have been many occasions where the events just simply went rogue on me. Bob Larson told me to import all objects and that fixed it.
It often seems to me that the envents and associated flickering diminish after doing that. The Access project is always more compact than a simple Compact and Repair. Perhaps there is a type of re-indexing of the code as well?

It is late on Friday, I must head to the Convention Center and set up a booth now.
Sorry, that was the best I can do for now.
 
It doesn't make any sense to me to turn echo off and on without executing code in between.

Use echo to stop screen updates if you're running a process that makes lots of visible changes and you want them to appear to occur all at once. Then, turn echo off, make your changes, and turn echo back on, which has the effect of showing all those changes as one screen update.

To me, the flicker is hardly noticeable if you just remove all your echo true and echo false code.
 
I have piles of code executing in my original db- I just shaved it down to the flickering culprits
 
Does this make any difference?
Code:
Private Sub List2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Echo False
End Sub

Private Sub List2_Click()
[COLOR="Green"]    'run screen upate code here[/COLOR]
    Echo True
End Sub
Note that MouseUp happens before Click
 
Thanks, but no change
sad-face.gif


With Echo set to False and then True after changes, all controls flicker (I update their values from the initial listbox) incl the list on whioch I click, and the entire form! When I don't mess with Echo ie just leave it on) , then the form does not flicker, neither does the listbox on which I click to trigger all this. The remaining updated controls flicker.
 
This is just weird: I'm better of not using the Echo False at all - then only controls flicker.

I have tried an API function taken form here:
http://www.experts-exchange.com/Database/MS_Access/Q_27976557.html

Code:
Public Declare Function api_LockWindow32 Lib "user32" Alias "LockWindowUpdate" (ByVal hwndLock As Long) As Long
                                    Public Declare Function FindWindowEx  Lib "user32" Alias "FindWindowExA" (ByVal hWndParent As Long, ByVal  hWndChid As Long, ByVal lpClassName As String, ByVal lpWindowName As  String) As Long
                                    
Public Sub atLockWindow(TrueOrFalse As Boolean)
                                    
  Dim Status&, hWndTarget&

  On Error Resume Next
  If TrueOrFalse = True Then
  hWndTarget = FindWindowEx(Application.hWndAccessApp, 0&, "MDIClient", vbNullString)
  If hWndTarget <> 0 Then 
       Status = api_LockWindow32(hWndTarget)
  Else
        Status = api_LockWindow32(0)
  End If
End Sub
where I just call it like

atLockWindow True
... my code
atLockWindow False

which prevents the entire form from flickering, but the controls - with the exception of the listbox I click on - flicker happily.:eek:
 
That is amazing! I found that code before, glad you updated the results.
We are cursing our Access list box controls because the events don't seem consistant.
I have a list box that fires my Rule Engine. Granted, a rule can take 1/10 of a secod to run. If the user down arrows too fast, there is an untrapped error.
We are lamenting using / not using 3rd party controls. The overhead of 3rd party maintence presents its own problems.

Please keep up the comments. My solution was to put a hold on the next click event until the code was finished running.

Please consider creating an empty DB and importing all objects. There have been many times that this just made things regarding a change in focus behave differently (as in fix it).
 

Users who are viewing this thread

Back
Top Bottom