Then I named the gui window, and the right click no longer worked.
How to specify the GuiContextMenu to respond to the right click occurring in the named window?
Code: Select all
GoSub, CreateMain
Return
CreateMain:
; ADDED Window Naming
Gui, Main:New
Gui, Main:Add, ListView, Center vList, A1|A2|A3
Gui, Main:Show
; ADDED Filler Data
Loop, 4
{
LV_Add("", A_Index, "Crap", "Mo Crap")
}
; Create a popup menu to be used as the context menu:
Menu, Main:MyContextMenu, Add, Action01, Edit
Menu, Main:MyContextMenu, Add, Action02, Edit
Return
GuiContextMenu: ; Launched in response to a right-click or press of the Apps key.
if A_GuiControl <> List ; Display the menu only for clicks inside the ListView.
return
; Show the menu at the provided coordinates, A_GuiX and A_GuiY. These should be used
; because they provide correct coordinates even if the user pressed the Apps key:
Menu, Main:MyContextMenu, Show, %A_GuiX%, %A_GuiY%
Return
Edit:
A1=xxx ;just an example
A2=xx1
B1=xx2
B2=xx3
Loop, 4
{
LV_Add(%A_index% Auto, A%A_Index%, B%A_Index%, C%A_Index%)
LV_ModifyCol(%A_index%,AutoHdr)
}
Return