ListView wrote:
If the window has more than one ListView control, by default the functions operate upon the one most recently added. To change this, specify Gui, ListView, ListViewName, where ListViewName is the name of the ListView's associated variable or its ClassNN as shown by Window Spy. Once changed, all existing and future threads will use the indicated ListView.
It would be nice if this command updates a variable such as A_ListView (global) with the Hwnd of the current ListView so that I can do something like this (based on code from Skan):
Code:
;Lib\LV.ahk
LV_GetCol(Column=1, parameter="width"){
If (parameter = "width)
{
SendMessage, (LVM_GETCOLUMNWIDTH := 0x101D), (Column-1),0,, ahk_id %A_ListView%
Return ErrorLevel
}
}
I am slowly building a StdLib compatible collection of LV functions, and it would be nice to not have to pass the HWND, since all the built-in LV functions do not need it. (keeps the style nice), though I suppose for now I will do it the same way as the excellent LV Color changing script, which is alread in my library.
Code:
LV_ColorInitiate(Index_Column=1,Gui_Number=1, Control="SysListView321") ; initiate listview color change procedure
{
global hw_LV_ColorChange, LV_Index_Column
LV_Index_Column := Index_Column
Gui, %Gui_Number%:+Lastfound
Gui_ID := WinExist()
ControlGet, hw_LV_ColorChange, HWND,, %Control%, ahk_id %Gui_ID%
OnMessage( 0x4E, "WM_NOTIFY" )
}