Jump to content
Sign in to follow this  
SlowCoder74

Quick-Update Display with a lot of labels

Recommended Posts

SlowCoder74

I've got a tracker/wallboard project underway.  I previously wrote the project in Classic ASP, but since it will now be distributed throughout the company, I am rewriting it in AutoIT for ease of setup.

The tracker contains a good deal of data that is updated every few seconds.  With the ASP version, the display is updated quickly, with only a very minor, almost unnoticeable flicker.  As I transcribe it into AutoIT, and I haven't even gotten to updating all the information yet, there appears to be a very noticeable "scroll" as it updates each of the labels.

Is there a way to "freeze" the display during update, then display the newly updated data quickly?

If you remember the old DOS days, you could display screen 0 page, while updating the other, then flip the displays, producing an instant update.

Share this post


Link to post
Share on other sites
water

GUISetState with @SW_LOCK (Lock the window to avoid repainting) and @SW_UNLOCK (Unlock windows to allow painting)?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
SlowCoder74

GUISetState with @SW_LOCK (Lock the window to avoid repainting) and @SW_UNLOCK (Unlock windows to allow painting)?

Yes, that almost had it!  However, when @SW_UNLOCK was called, it would actually cause a flicker, I suppose as the entire screen was repainted.  That flicker wasn't as bad as it was before, but still noticeable.

My current solution is a little different.  I wrote this small function to only update if the text, foreground or background colors have changed.

#include "_GetCtrlColorEx.au3"

Func UpdateLabel($LabelhWnd,$LabelText,$FGColor,$BGColor)
   ;only updates if values have changed.  Mitigates display flicker/speed issues
   
   ;text
   if GUICtrlRead($LabelhWnd) <> $LabelText then GUICtrlSetData($LabelhWnd,$LabelText)
   ;fgcolor
   if _GUICtrlGetTextColorEx($LabelhWnd,1) <> $FGColor then GUICtrlSetColor($LabelhWnd,$FGColor)
   ;bgcolor
   if _GUICtrlGetBkColorEx($LabelhWnd,1) <> $BGColor then GUICtrlSetBkColor($LabelhWnd,$BGColor)
EndFunc

There is still a sort of roll while it updates, but it's checking/updating over 200 labels, and while it's difficult to measure it, seems to take less than 1/10th second.

Any ideas for further improvement?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×