Jump to content

Recommended Posts

Posted

Hey all!

So, after a few years, just recently I've returned to AutoIt, And still haven't solved an annoying issue with GUI's.

 

The thing is, that most kind of procedures from a While loop, like ConrolMove or GuiCtrlSetData on progressbars seem to happen with different speeds. For example, when I move the mouse, these procedures on controls seem to speed up and slow down when idle. Even more after a few seconds. I've tried with and without Sleep, but this doesn't solve the issue. Not even when GuiGetMsg is absent. And prefer not to use AdlibRegister, unless there's a savvy way, that I don't know about.

 

Here's a simple example, that I've used:

$gui = GUICreate("Progress", 220, 70)
$gui_progress1 = GUICtrlCreateProgress(10, 10, 200, 20)
$gui_progress2 = GUICtrlCreateLabel("", 10, 40, 200, 20)
GUICtrlSetBkColor($gui_progress2, 0x80c0b0)
GUISetState()

Local $count = 0

While 1

      $guimsg = GUIGetMsg()
      If $guimsg = -3 Then ExitLoop

      $count = $count + 1
      If $count > 100 Then $count = 0

      GUICtrlSetData($gui_progress1, $count)
      ControlMove("Progress", "", $gui_progress2, 10, 40, $count * 2, 20)

      Sleep(1)

WEnd

 

So, my question is, is there a way to keep the GUI control activitiy speed constant, no matter if any other user input is used?

 

 

 

Posted
Sleep(1)

is useless. Beside under 10, sleep will take a default value (see help file to understand).

2 hours ago, Archaic said:

So, my question is, is there a way to keep the GUI control activitiy speed constant, no matter if any other user input is used?

what other user input ?  

Posted

@Nine,

I knew that, it's easier to type a 1 than a 10. And my goal wasn't to use a delay, but a function that might have some influence on the issue.

 

@AutoBert,

Actually, I've tracked down a few posts in the meanwhile, where an OS issue was pointed out. I was testing this on a Win7 PC. While on my Win10 laptop, this issue is non-existent. I guess this changes my question to: if anyone knows the reason for the difference in AutoIt functioning between the OS versions and an eventual solution.

 

Posted (edited)
#include <WinAPITheme.au3> ;    <----
$gui = GUICreate("Progress", 220, 70)
$gui_progress1 = GUICtrlCreateProgress(10, 10, 200, 20)
_WinAPI_SetWindowTheme(GUICtrlGetHandle(-1), "", "") ;  <----
$gui_progress2 = GUICtrlCreateLabel("", 10, 40, 200, 20)
GUICtrlSetBkColor($gui_progress2, 0x80c0b0)
GUISetState()

Local $count = 0

While 1

      $guimsg = GUIGetMsg()
      If $guimsg = -3 Then ExitLoop

      $count = $count + 1
      If $count > 100 Then $count = 0

      GUICtrlSetData($gui_progress1, $count)
      ControlMove("Progress", "", $gui_progress2, 10, 40, $count * 2, 20)

      ; Sleep(1)

WEnd

https://www.autoitscript.com/forum/topic/207063-show-percentage-in-the-middle-of-the-progress-bar/?do=findComment&comment=1492823

 

P.S. tested on win10 and win11:

on win10 it works fine, on win11 the progressbar goes crazy

Edited by Gianni

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

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...