Uses AHK v2-a100.
Code: Select all
global count := 0
main := GuiCreate()
btn := main.addButton(, "Increase count")
btn.OnEvent("click", () => SendMessage(LVM_RESETEMPTYTEXT := 0x1054, 0, 0, LV.hwnd))
LV := main.addListView("w600 h400", "Column 1|Column 2")
LV.OnNotify(LVN_GETEMPTYMARKUP := -187, "setEmptyText")
LV.OnNotify(LVN_LINKCLICK := -184, () => ToolTip("Clicked!"))
main.show()
return
setEmptyText(ctrl, l) {
text := "<a>My empty text!`nCount = " count++ "</a>"
; see LVN_GETEMPTYMARKUP
; 0 displays the text in the upper-left corner while 1 displays it centered both vertically and horizontally
NumPut(0x1, l, A_PtrSize * 3, "UInt")
; put our string in the buffer
StrPut(text, l + A_PtrSize * 3 + 4, StrLen(text))
return true ; you must return true in order to set the text. This can be used to your advantage to return false to not change it possibly
}