Currently I subclass a buttons like this:
SetWindowSubclass(id(50 hDlg) &sub.WndProc_Subclass_buttons 1 0)
SetWindowSubclass(id(51 hDlg) &sub.WndProc_Subclass_buttons 1 0)
...etc
Questions:
1)
Is the above way the correct method regarding the "uIdSubclass" parameter? (which is "1", see above.)
I am asking this because I want to pass the control ID in "uIdSubclass" so I can use it in the subfunction (see question 2)
(And probably I was using subclassing incorrect?)
2)
Can I subclass like this?
SetWindowSubclass(id(50 hDlg) &sub.WndProc_Subclass_buttons 50 0)
SetWindowSubclass(id(51 hDlg) &sub.WndProc_Subclass_buttons 51 0)
(So I can use "uIdSubclass" to store control ID and then use it in subfunction below. And if this is not the correct way to pass control ID to subclass subfunction, is there another way?)
Below the subclass subfunction, where I output the clicked control ID
SetWindowSubclass(id(50 hDlg) &sub.WndProc_Subclass_buttons 1 0)
SetWindowSubclass(id(51 hDlg) &sub.WndProc_Subclass_buttons 1 0)
...etc
Questions:
1)
Is the above way the correct method regarding the "uIdSubclass" parameter? (which is "1", see above.)
I am asking this because I want to pass the control ID in "uIdSubclass" so I can use it in the subfunction (see question 2)
(And probably I was using subclassing incorrect?)
2)
Can I subclass like this?
SetWindowSubclass(id(50 hDlg) &sub.WndProc_Subclass_buttons 50 0)
SetWindowSubclass(id(51 hDlg) &sub.WndProc_Subclass_buttons 51 0)
(So I can use "uIdSubclass" to store control ID and then use it in subfunction below. And if this is not the correct way to pass control ID to subclass subfunction, is there another way?)
Below the subclass subfunction, where I output the clicked control ID
#sub WndProc_Subclass_buttons ;;menu File -> New -> Templates -> Wndproc -> WndProc_Subclass
function# hwnd message wParam lParam uIdSubclass dwRefData
sel message
case WM_RBUTTONUP
case WM_RBUTTONDBLCLK
case WM_MBUTTONUP
case WM_MBUTTONDBLCLK
case WM_LBUTTONUP
out uIdSubclass ;; output the ID of the clicked control ;; <================ here I use the "uIdSubclass"
case WM_LBUTTONDBLCLK
int R=DefSubclassProc(hwnd message wParam lParam)
sel message
case WM_NCDESTROY
RemoveWindowSubclass(hwnd &sub.WndProc_Subclass_buttons uIdSubclass)
ret R