The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 895 - File: showthread.php PHP 7.2.34 (Linux)
File Line Function
/showthread.php 895 errorHandler->error




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Subclass "uIdSubclass" parameter
#1
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
 
Code:
Copy      Help
#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


Messages In This Thread
Subclass "uIdSubclass" parameter - by r0n - 09-15-2019, 01:19 AM
RE: Subclass "uIdSubclass" parameter - by Kevin - 09-15-2019, 02:40 AM
RE: Subclass "uIdSubclass" parameter - by r0n - 09-15-2019, 04:04 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)