GUI ListView/ListBox RightClick-event with associated function object

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
hotkeyguy
Posts: 170
Joined: 11 Oct 2014, 12:22

GUI ListView/ListBox RightClick-event with associated function object

15 Apr 2021, 06:22

Hello again,

RightClick-event works with ListViews, but not with ListBoxes.
ListViews: The corresponding function is called and A_GuiEvent = "RightClick".
ListBoxes: Nothing happens. Left click works, then A_GuiEvent = "Normal".


Any hints are highly appreciated!

Many thanks and greetings
hotkeyguy
User avatar
mikeyww
Posts: 26848
Joined: 09 Sep 2014, 18:38

Re: GUI ListView/ListBox RightClick-event with associated function object

15 Apr 2021, 06:47

Code: Select all

Gui, Add, ListBox, r5 vColorChoice, Red|Green|Blue|Black|White
Gui, Show, w220, List
OnMessage(0x0204, "WM_RBUTTONDOWN")
Return

WM_RBUTTONDOWN(wParam, lParam) {
 x := lParam & 0xFFFF, y := lParam >> 16
 If !A_GuiControl
  Return
 ToolTip, You right-clicked in GUI window #%A_Gui% at client coordinates (%x%`,%y%) in control %A_GuiControl%.
}
hotkeyguy
Posts: 170
Joined: 11 Oct 2014, 12:22

Re: GUI ListView/ListBox RightClick-event with associated function object

15 Apr 2021, 15:08

I'm aware of
just me wrote:
15 Apr 2021, 10:16
GuiContextMenu
but its use is not so smooth compared to the ListView and an function object.

When GuiContextMenu is triggered, the context menu is shown. I use GuiContextMenu as function, and for the menu items (LabelOrSubmenu) I'm using functions, too.

My main question now is whether it's possible to pass an additional paramater from GuiContextMenu(...) to LabelOrSubmenu(...) via an function object for the menu item. Basically my function object for the menu item is working, but not with an additional parameter. Is ObjBindMethod() the solution?
hotkeyguy
Posts: 170
Joined: 11 Oct 2014, 12:22

Re: GUI ListView/ListBox RightClick-event with associated function object

16 Apr 2021, 08:44

Why is the following not possible:
Menu, MenuItem, Add, % "MenuCaption", % FunctionObject.Call( "Parameter" )
or
Menu, MenuItem, Add, % "MenuCaption", %FunctionObject%( "Parameter" )

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 248 guests