Page 1 of 1

[2.1-alpha.9] GuiControl.Prototype.OnMessage receives Gui in the callback's first parameter.

Posted: 08 Apr 2024, 22:28
by ntepa
I expected the GuiOrCtrlObj parameter to be Gui if the callback was passed to Gui.Prototype.OnMessage or GuiControl if GuiControl.Prototype.OnMessage is used. Instead, I always get a Gui object.

Code: Select all

#Requires AutoHotkey v2.1-alpha.9

g := Gui()
editCtrl := g.AddEdit("w200", "Edit")
LV := g.AddListView("w200 h100", [1,2,3])

WM_MOUSEMOVE := 0x0200
editCtrl.OnMessage(WM_MOUSEMOVE, GuiControlCallback)
LV.OnMessage(WM_MOUSEMOVE, GuiControlCallback)
OnMessage(WM_MOUSEMOVE, OnMessageCallback)
g.Show()

GuiControlCallback(GuiOrCtrlObj, wParam, lParam, msg) {
    ; GuiOrCtrlObj is always Gui
    OutputDebug("GuiControl.OnMessage: " Type(GuiOrCtrlObj))
}

OnMessageCallback(wParam, lParam, msg, hwnd) {
    ; If hovering over a control, hwnd is a handle to the control.
    if CtrlObj := GuiCtrlFromHwnd(hwnd)
        OutputDebug("OnMessage: " Type(CtrlObj))
}

Re: [2.1-alpha.9] GuiControl.Prototype.OnMessage receives Gui in the callback's first parameter.  Topic is solved

Posted: 07 May 2024, 06:34
by lexikos
Fixed by v2.1-alpha.10.