When left-clicking on any of the 3 rows, I am trying to have the messagebox return the variable associated with the icon on that particular row.
But, I can't figure out how to assign a variable to the icon.
So for example if you click on the first row (which is the regedit icon), the messagebox should say "you clicked on Row1, the text is %description% and the variable associated with the icon is regedit"
..or something like that.
I hope this makes sense. Here's what I've got so far:
Code: Select all
Gui, Add, ListView, Altsubmit gClick vMyListView h200 w180 , Icon & Number|Description ; Create a ListView.
ImageListID := IL_Create(3) ; Create an ImageList to hold 3 small icons.
LV_SetImageList(ImageListID) ; Assign the above ImageList to the current ListView.
IL_Add(ImageListID gClick vregedit, "C:\Windows\regedit.exe", regedit)
IL_Add(ImageListID gClick vnotepad, "C:\Windows\notepad.exe", notepad)
IL_Add(ImageListID gClick vexplorer, "C:\Windows\explorer.exe", explorer)
Loop 3 ; Add rows to the ListView (for demonstration purposes, one for each icon).
LV_Add("Icon" . A_Index, A_Index, "description")
LV_ModifyCol("Hdr") ; Auto-adjust the column widths.
Gui Show
return
GuiClose: ; Exit the script when the user closes the ListView's GUI window.
ExitApp
return
Click:
if A_GuiEvent = Normal
{
LV_GetText(RowText1, A_EventInfo, 1) ; Get the text of the first field.
LV_GetText(RowText2, A_EventInfo, 2) ; Get the text of the second field
msgbox, the text in the first column is %RowText1% and the text in the second column is %RowText2%
}
Return