Seems your qm doesn't like optional function parameters .
What qm version are you using?
try this
Function DialogSubclassExample
and if still error try this
Function DialogSubclassExample
and if your not using the latest qm please update qm and try again. Latest version is 2.4.8.2
can be found here http://www.quickmacros.com/download.html
What qm version are you using?
try this
Function DialogSubclassExample
out
QMITEM qmac; int imac
ARRAY(str) amac
rep
,imac=qmitem(-imac 2 &qmac 1)
,if(imac=0) break
,if qmac.itype=1
,,amac[]=qmac.name
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Win Dialog subclass example"
;3 Button 0x54032000 0x0 116 52 100 14 "Right click on the popup"
;4 ComboBox 0x54230641 0x0 8 8 96 120 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040801 "*" "" "" ""
str controls = "4"
str cb4
cb4=amac
if(!ShowDialog(dd &sub.DlgProc &controls)) ret
#sub DlgProc v
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,int hbc=id(3 hDlg)
,int hcbc=child("" "ComboLBox" id(4 hDlg) 0x0 "id=1000") ;;list
,SetWindowSubclass hbc &sub.WndProc_Subclass 1 0
,SetWindowSubclass hcbc &sub.WndProc_Subclass 1 0
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#sub WndProc_Subclass
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_RBUTTONUP
,Acc a.FromMouse
,int rcrn=a.Role
,str rcitem=a.Name
,if rcrn=34
,,int rccbh=a.Hwnd
,,int rciti= a.elem -1
,,mac "sub.rcmessage" "" rcrn rcitem rciti rccbh
,else
,,mac "sub.rcmessage" "" rcrn rcitem
int R=DefSubclassProc(hwnd message wParam lParam)
sel message
,case WM_NCDESTROY
,RemoveWindowSubclass(hwnd &sub.WndProc_Subclass uIdSubclass) ;;replace ThisFunction with the name of this function or subfunction (eg sub.WndProc_Subclass)
,;case ...
ret R
#sub rcmessage
function# i [~item][#itemindex][#chwnd]
str mtext
sel i
,case 43:
,mtext="button was right clicked"
,case 34:
,,;mtext.format("combo list item: (%s) was right clicked" item)
,,CB_SelectItem(chwnd itemindex)
,,mac+ item
,case 33:
,,mtext="combo list was right clicked on an empty item"
if(!empty(mtext))
,mes(mtext)
and if still error try this
Function DialogSubclassExample
out
QMITEM qmac; int imac
ARRAY(str) amac
rep
,imac=qmitem(-imac 2 &qmac 1)
,if(imac=0) break
,if qmac.itype=1
,,amac[]=qmac.name
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Win Dialog subclass example"
;3 Button 0x54032000 0x0 116 52 100 14 "Right click on the popup"
;4 ComboBox 0x54230641 0x0 8 8 96 120 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040801 "*" "" "" ""
str controls = "4"
str cb4
cb4=amac
if(!ShowDialog(dd &sub.DlgProc &controls)) ret
#sub DlgProc v
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,;int hbc=id(3 hDlg)
,int hcbc=child("" "ComboLBox" id(4 hDlg) 0x0 "id=1000") ;;list
,;SetWindowSubclass hbc &sub.WndProc_Subclass 1 0
,SetWindowSubclass hcbc &sub.WndProc_Subclass 1 0
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#sub WndProc_Subclass
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_RBUTTONUP
,Acc a.FromMouse
,int rcrn=a.Role
,str rcitem=a.Name
,if rcrn=34
,,int rccbh=a.Hwnd
,,int rciti= a.elem -1
,,mac "sub.rcmessage" "" rcrn rcitem rciti rccbh
,;else
,,;mac "sub.rcmessage" "" rcrn rcitem
int R=DefSubclassProc(hwnd message wParam lParam)
sel message
,case WM_NCDESTROY
,RemoveWindowSubclass(hwnd &sub.WndProc_Subclass uIdSubclass) ;;replace ThisFunction with the name of this function or subfunction (eg sub.WndProc_Subclass)
,;case ...
ret R
#sub rcmessage
function# i ~item #itemindex #chwnd
str mtext
sel i
,case 43:
,mtext="button was right clicked"
,case 34:
,,;mtext.format("combo list item: (%s) was right clicked" item)
,,CB_SelectItem(chwnd itemindex)
,,mac+ item
,case 33:
,,mtext="combo list was right clicked on an empty item"
if(!empty(mtext))
,mes(mtext)
and if your not using the latest qm please update qm and try again. Latest version is 2.4.8.2
can be found here http://www.quickmacros.com/download.html