Modify ↓
#536 closed Bug (Wont Fix)
ControlGetFocus() prevents double-clicks
Reported by: | MarcoM | Owned by: | |
---|---|---|---|
Milestone: | Component: | AutoIt | |
Version: | 3.2.12.0 | Severity: | None |
Keywords: | ControlGetFocus | Cc: |
Description (last modified by Jpm)
It seems that polling which control has the focus with ControlGetFocus() resets somehow the mouse click counter/timer...
Here is a code sample showing this:
While 1 $CurrentWin = WinGetHandle("[Active]") $CurrentControl = ControlGetFocus ($CurrentWin) Sleep(50) Wend
Double-clicks are not detected anymore when this code is running.
Attachments (0)
Change History (3)
comment:1 Changed 16 years ago by Jpm
- Description modified (diff)
comment:2 Changed 16 years ago by Valik
- Resolution set to Wont Fix
- Status changed from new to closed
comment:3 Changed 16 years ago by MarcoM
As a workaround, you can test for the left click and if it is pressed, wait a little longer than the double-click maximal interval before getting focus information. That will avoid resetting input events and still allow high frequency focus polling.
Here is an example of the workaround code:
#include <Misc.au3> $DoubleClickPeriod = RegRead("HKCU\Control Panel\Mouse", "DoubleClickSpeed") While 1 $CurrentWin = WinGetHandle("[Active]") If _IsPressed("01", "user32.dll") Then Sleep($DoubleClickPeriod+50) Else $CurrentControl = ControlGetFocus ($CurrentWin) Sleep(10) EndIf Wend
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
Note: See
TracTickets for help on using
tickets.
This can't be fixed. It's a quirk of windows that when getting focus the input state is reset (keyboard state, mouse state, et cetera). You can still double-click, you just now have to do it faster than the polling interval since it's going to reset the mouse input each time.
Closing as won't fix because while it is undesirable behavior it can't be fixed since it's a Windows design problem.