You can interact with the top listview (white background) using the mouse and keyboard and the resulting A_EventInfo and A_GuiEvent values are displayed in the bottom listview (black background) in real time. Here's the code:
Code: Select all
#NoEnv
#NoTrayIcon
#SingleInstance Force
LogMaxRows := 10 ;log this many rows
Gui, Margin, 10, 10
Gui, Add, ListView, cBlue Checked AltSubmit -ReadOnly +Grid w229 r10 vLV_TestArea gLV_TestArea, A|B|C|D|E
Gui, Add, ListView, +Multi BackgroundBlack c00FF00 wp r%LogMaxRows% vLV_Log, A_EventInfo|A_GuiEvent|ErrorLevel
Gui, Add, Button, gClearLog w110 h30, Clear log
Gui, Add, Button, gCopyLog wp h30 x+9 yp, Copy selected
Gui, ListView, LV_TestArea
LV_ModifyCol(1, "100")
Loop 4
LV_Add("", "Edit this text", A_Index, A_Index, A_Index, A_Index)
Gui, ListView, LV_Log
LV_ModifyCol(1, "75")
LV_ModifyCol(2, "75")
LV_ModifyCol(3, "75")
Gui, Show,, ListView Tester
Return
LV_TestArea:
Critical
Gui, ListView, LV_Log
If (LV_GetCount() = LogMaxRows) ;trim log
LV_Delete(1)
LV_Modify(LV_Add("", A_EventInfo, A_GuiEvent,ErrorLevel), "Vis")
Return
GuiClose:
ExitApp
Return
ClearLog:
Gui, ListView, LV_Log
LV_Delete()
Return
CopyLog:
Gui, ListView, LV_Log
LogText :=
RowNumber := 0
Loop
{
RowNumber := LV_GetNext(RowNumber)
If !RowNumber
Break
RowText :=
Loop, 3
{
LV_GetText(Text, RowNumber, A_Index)
RowText .= Text "`t"
}
LogText .= RowText "`n"
}
Clipboard := LogText
Return