sending ^{Click} to ListView with AltSubmit makes it freeze

Report problems with documented functionality
User avatar
Barney
Posts: 55
Joined: 28 May 2014, 20:03
Location: Germany

sending ^{Click} to ListView with AltSubmit makes it freeze

09 Nov 2017, 00:06

Clicking the row with the left mouse button freezes the Gui and makes AHK use 100% CPU.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance force


Gui, Add, ListView, r20 w700 AltSubmit gMyListView, Name
LV_Add("", "click here")
Gui, Show
return

MyListView:
return

#IfWinActive ahk_class AutoHotkeyGUI
	LButton::
		send ^{Click}
return

GuiClose:  ; Indicate that the script should exit automatically when the window is closed.
ExitApp
It doesn't happen when using sendEvent ^{Click}
just me
Posts: 9442
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: sending ^{Click} to ListView with AltSubmit makes it freeze

10 Nov 2017, 11:54

:arrow: Default List-View Message Processing

As soon as ListViews receive a LBUTTONDOWN message they enter an own modal message loop "until either the button is released or the mouse is moved". There are some other known cases causing the GUI to freeze while the script is running using 100 % of one processor core, all caused by LBUTTONDOWN events. Seemingly, the ListView control doesn't get the proper mouse message which will stop its message loop.

While the ListView's message loop is running, message posted by the script internally to handle GUI events are dispatched to the AHK window procedure (or reposted) by the ListView control, and when processed by the script afterwards, reposted again. It's called a 'bouncing effect' in the AHK source code.

This issue couldn't be solved as yet. I hope this new case will shed some more light on the reason. In the meantime, you should feel happy to have a workaround with SendEvent.

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 5 guests