Jump to content

Recommended Posts

Posted

add sleep(100) in the while loop.

or whatever amount you want to sleep really.

it will cut down on cpu usage and flash less.

Posted

add sleep(100) in the while loop.

or whatever amount you want to sleep really.

it will cut down on cpu usage and flash less.

Well, I gotta say, this DOES work. Although it is no longer "rapid updating".

Anyway, from all the posts I read about this when searching, this seems to be the only solution.

Thanks for your time!

Posted (edited)

Use ControlSetText instead of GUICtrlSetData.

Update only if new text is different from old text (in your example it always is, so this point is irrelevant, but in other uses it may not). That's just common sense.

Also, if you want to do it from the main loop, use event mode. Otherwise, adlib or timer. If you do in GuiGetMsg loop, the frequency it triggers depends on messages generated for the window. In idle mode it's ~10ms, much more if you move mouse over GUI. Unless the purpose of your counter is to count GUI events, such disparity isn't useful at all.

Edited by Siao

"be smart, drink your wine"

Posted

ControlSetText makes it flicker-free :)

Nice one!

And yeah, I will be switching it to on event mode. Thanks for the advice and for solving this one for me!

  • 3 weeks later...
Posted

dalisuit

How do I stop the flicker when loading a ListView. I tried adding the sleep, but it still flickers.

_GUICtrlListView_BeginUpdate()

_GUICtrlListView_EndUpdate()

  • 3 years later...
Posted

I know this is somewhat of a necro, but I'm adding this in case others Google this and find this topic like I did.

I ran into a similar problem using a script that was reading lines in an excel file. Here is how I resolved the issue:

$time = TimerInit()
 For $row = "1" To $totalRows
  $num = $num + _ExcelReadCell($book, $row, 8)
  $diff = TimerDiff($time)
  If $diff > 100 Then
   GUICtrlSetData($lbl2, "Reading line " & $row & " of " & $totalRows & ", " & $num & " Projects")
   $time = TimerInit()
  EndIf
 Next

With the wait set to 50ms, the update speed didn't look any different visually to me, so if you want it to look completely smooth you can set it to that.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...