[solved]Ahk V2 Listview ControlSetStyle problem Topic is solved

Discuss the future of the AutoHotkey language
rodemp
Posts: 29
Joined: 15 Nov 2016, 00:28

[solved]Ahk V2 Listview ControlSetStyle problem

09 Sep 2018, 01:25

Code: Select all

Gui := GuiCreate(,"Fixed Colum Width")
LV := Gui.Add("ListView", "r15 w200 Grid NoSortHdr -LV0x10", "A|B|C|D")
LVHeader:=SendMessage(0x101F, 0, 0, , "ahk_id " . LV.HWND) ; LVM_GETHEADER = 0x101F
ControlSetStyle +0x0800, , "ahk_id " . LVHeader
Loop 10
	LV.Add(,a_index,a_index+1,a_index*a_index)
Gui.Show()
Gui.OnEvent("Close", "Gui_Close")

Gui_Close() {
	ExitApp
}
When Fixed Colum Width is applied, there is a problem that the focus is lost when the column is clicked.

Code: Select all

;ahk v1
Gui, Add, ListView, r15 w200 Grid NoSortHdr -LV0x10 hwndLV, A|B|C|D
Loop 10
	LV_Add(,a_index,a_index+1,a_index*a_index)
SendMessage, 0x101F, 0, 0, , % "ahk_id " . LV
LVHeader:=ErrorLevel
Control, Style, +0x0800, , % "ahk_id " . LVHeader
Gui, Show,, Fixed Colum Width
Return

GuiClose:
ExitApp
Last edited by rodemp on 21 Sep 2018, 23:55, edited 2 times in total.
rodemp
Posts: 29
Joined: 15 Nov 2016, 00:28

Re: Ahk V2 Listview ControlSetStyle problem  Topic is solved

21 Sep 2018, 23:50

Code: Select all

Gui := GuiCreate(,"Fixed Colum Width")
LV := Gui.Add("ListView", "r15 w200 Grid NoSortHdr -LV0x10", "A|B|C|D")
LVHeader:=SendMessage(0x101F, 0, 0, , "ahk_id " . LV.HWND) ; LVM_GETHEADER = 0x101F
ControlSetStyle "+0x0800", , "ahk_id " . LVHeader
Loop 10
	LV.Add(,a_index,a_index+1,a_index*a_index)
Gui.Show()
Gui.OnEvent("Close", "Gui_Close")

Gui_Close() {
	ExitApp
}
ControlSetStyle style parameter must be enclosed in ""

or

currentstyle:=ControlGetStyle(,"ahk_id " LVHeader)
ControlSetStyle(currentstyle|0x0800, ,"ahk_id " LVHeader)

Return to “AutoHotkey v2 Development”

Who is online

Users browsing this forum: swagfag and 2 guests