08-05-2022, 05:06 PM
Not very easy in QM. Need to subclass the control.
Function Dialog249
Function Dialog249
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;3 Edit 0x54030080 0x200 56 8 96 12 ""
;4 Static 0x54000000 0x0 4 8 48 12 "Middle click"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "*" "" "" ""
str controls = "3"
str e3
if(!ShowDialog(dd &sub.DlgProc &controls)) ret
#sub DlgProc
function# hDlg message wParam lParam
;OutWinMsg message wParam lParam
sel message
,case WM_INITDIALOG
,SetWindowSubclass(id(3 hDlg) &sub.WndProc_Subclass1 1 0)
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#sub WndProc_Subclass1
function# hwnd message wParam lParam uIdSubclass dwRefData
;This function can be used with SetWindowSubclass as window procedure.
;<help>SetWindowSubclass</help> is the recommended way to subclass windows. Easier and safer than SetWindowLong. Example: SetWindowSubclass(hwnd &sub.WndProc_Subclass 1 0)
;OutWinMsg message wParam lParam ;;uncomment to see received messages
sel message
,case WM_MBUTTONDOWN
,out "middle down"
,case WM_MBUTTONUP
,out "middle up"
int R=DefSubclassProc(hwnd message wParam lParam)
sel message
,case WM_NCDESTROY
,RemoveWindowSubclass(hwnd &sub.WndProc_Subclass1 uIdSubclass)
,
,;case ...
ret R