Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Subclass ComboBox
#1
Hi,

I want to use , and . to select items in the combobox

In the following code, I can successfully intercept , and . But the following operation does not work

[Image: aaa.png]

Q1:
Line53: Setting id 3 has no effect, 1001 has effect, It's a bit hard to understand
    SetWindowSubclass(id(1001 hDlg) &sub.WndProc_Subclass_ComboBox 1 0)

Q2:
How to subclass QM_ComboBox controls? Is this possible? e.g: qmcb6 qmcb7 qmcb8

I don't quite understand control subclassing

Thanks in advance for any advice and help
david

Macro subclass_combobox
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;3 ComboBox 0x54230242 0x0 8 24 96 213 ""
;4 ComboBox 0x54230242 0x0 8 48 96 213 ""
;5 ComboBox 0x54230242 0x0 8 72 96 213 ""
;6 QM_ComboBox 0x54030242 0x0 120 24 96 13 ""
;7 QM_ComboBox 0x54030242 0x0 120 48 96 13 ""
;8 QM_ComboBox 0x54030242 0x0 120 72 96 13 ""
;9 Static 0x54000000 0x0 8 8 48 12 "ComboBox"
;10 Static 0x54000000 0x0 120 8 48 12 "QM_ComboBox"
;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 4 5 6 7 8"
str cb3 cb4 cb5 qmcb6 qmcb7 qmcb8
cb3=
;one
;two
;three
cb4=
;one
;two
;three
cb5=
;one
;two
;three
qmcb6=
;qmcb6
;one
;two
;three
qmcb7=
;qmcb7
;one
;two
;three
qmcb8=
;qmcb8
;one
;two
;three
if(!ShowDialog(dd &sub.DlgProc &controls)) ret

#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,SetWindowSubclass(id(1001 hDlg) &sub.WndProc_Subclass_ComboBox 1 0)
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

#sub WndProc_Subclass_ComboBox
function# hwnd message wParam lParam uIdSubclass dwRefData

;OutWinMsg message wParam lParam ;;uncomment to see received messages

sel message
,case WM_CHAR
,sel(wParam)
,,case 0x2C ;; ,
,,;mes "Pressed the , key"
,,key D
,,ret
,,case 0x2E ;; .
,,;mes "Pressed the . key"
,,key U
,,ret
int R=DefSubclassProc(hwnd message wParam lParam)

sel message
,case WM_NCDESTROY
,RemoveWindowSubclass(hwnd &sub.WndProc_Subclass_ComboBox uIdSubclass)
ret R


Messages In This Thread
Subclass ComboBox - by Davider - 09-06-2022, 09:56 AM
RE: Subclass ComboBox - by Gintaras - 09-06-2022, 10:06 AM
RE: Subclass ComboBox - by Davider - 09-06-2022, 12:10 PM
RE: Subclass ComboBox - by Gintaras - 09-06-2022, 12:20 PM
RE: Subclass ComboBox - by Davider - 09-07-2022, 11:35 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)