colored listview headers Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
just me
Posts: 9424
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: colored listview headers

Post by just me » 08 Dec 2021, 04:02

Well, you removed this check

Code: Select all

      ; If HeaderColors contains an appropriate key ...
      If HeaderColors.HasKey(HHD) {
which additionally ensures that the sender is a header control.

Apparently tooltip controls also send NM_CUSTOMDRAW notifications to the list-view. The following seems to solve your 'issue':

Code: Select all

		;GET: Sending control's HWND
			HHD := NumGet(L + OHWND, "UPtr")
			If !(HHD = DllCall("SendMessage", "Ptr", H, "UInt", 0x101F, "Ptr", 0, "Ptr", 0, "UPtr")) ; LVM_GETHEADER
				Return 0 ; CDRF_DODEFAULT

User avatar
KruschenZ
Posts: 44
Joined: 20 Jan 2021, 07:05
Location: Germany (Rheinhessen)
Contact:

Re: colored listview headers

Post by KruschenZ » 09 Dec 2021, 07:38

just me wrote:
08 Dec 2021, 04:02
Well, you removed this check

Code: Select all

      ; If HeaderColors contains an appropriate key ...
      If HeaderColors.HasKey(HHD) {
which additionally ensures that the sender is a header control.

Apparently tooltip controls also send NM_CUSTOMDRAW notifications to the list-view. The following seems to solve your 'issue':

Code: Select all

		;GET: Sending control's HWND
			HHD := NumGet(L + OHWND, "UPtr")
			If !(HHD = DllCall("SendMessage", "Ptr", H, "UInt", 0x101F, "Ptr", 0, "Ptr", 0, "UPtr")) ; LVM_GETHEADER
				Return 0 ; CDRF_DODEFAULT
Hi @just me,

thank you very much, this works perfect for me :-) :dance: :salute:


I have a new issue, a strange thing:

The GetKeyState("LButton") doesn´t work, if I click in the ListView.

add after GUI Show:

Code: Select all

SetTimer, Timer_Check, 50
Label:

Code: Select all

Timer_Check:
	MouseGetPos,,, Mouse_Window, H_MouseOver, 2
	WinGetClass, WinGet_Class, % "ahk_id " Mouse_Window
	
	If (WinGet_Class = "AutoHotkeyGUI")
	{
		If GetKeyState("LButton")
		{
			MsgBox % "Mouseclick"
		}
	}
	
	Return
This is only, if I use this function...
it looks like the function catches this mouse click.

Thanks again.

Many regards
KruschenZ

just me
Posts: 9424
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: colored listview headers

Post by just me » 11 Dec 2021, 06:10

Hi, comment out the

Code: Select all

	Critical 1000 ; ?
and try if it works for you. The change might entail other issues.

User avatar
KruschenZ
Posts: 44
Joined: 20 Jan 2021, 07:05
Location: Germany (Rheinhessen)
Contact:

Re: colored listview headers

Post by KruschenZ » 13 Dec 2021, 02:54

just me wrote:
11 Dec 2021, 06:10
Hi, comment out the

Code: Select all

	Critical 1000 ; ?
and try if it works for you. The change might entail other issues.
Hi @just me,

yes, now new issues appeared.

But with:

Code: Select all

DllCall("GetAsyncKeyState", "Int", 0x01)
It seems to work better at this place then GetKeyState("LButton").
So I`ll check now for both :-)

Thanks again.

Many regards
KruschenZ

Post Reply

Return to “Ask for Help (v1)”