hello, I created a function that can display a list of QM items in a combo box, Macros, functions, autotext and item are grouped, Please see the picture below, but I don't know how to execute item in it.
I need to implement the following features:
1. After selecting the item, double click or enter, can execute it
2. After selecting the item, right click to edit it
3. After selecting the item, press the esc key to cancel the selection and position the cursor in the edit box where it is located, waiting for input.
4. Press the esc key twice to close the dialog box.
If there are too many hotkeys defined, it is not easy to remember. Executing with the above method is sometimes convenient.
Any suggestions are welcome, thanks in advance
Macro QM_item_manage
I need to implement the following features:
1. After selecting the item, double click or enter, can execute it
2. After selecting the item, right click to edit it
3. After selecting the item, press the esc key to cancel the selection and position the cursor in the edit box where it is located, waiting for input.
4. Press the esc key twice to close the dialog box.
If there are too many hotkeys defined, it is not easy to remember. Executing with the above method is sometimes convenient.

Any suggestions are welcome, thanks in advance

Macro QM_item_manage
out
QMITEM qmac; int imac
ARRAY(str) amac
rep
,imac=qmitem(-imac 2 &qmac 1)
,if(imac=0) break
,if qmac.itype=0
,,amac[]=qmac.name
,,
,,
QMITEM qfun; int ifun
ARRAY(str) afun
rep
,ifun=qmitem(-ifun 2 &qfun 1)
,if(ifun=0) break
,if qfun.itype=1
,,afun[]=qfun.name
,,
,,
QMITEM qaut; int iaut
ARRAY(str) aaut
rep
,iaut=qmitem(-iaut 2 &qaut 1)
,if(iaut=0) break
,if qaut.itype=4
,,aaut[]=qaut.name
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 426 204 "QM_item_manage"
;3 ComboBox 0x54230641 0x0 8 24 98 172 "Mac"
;5 Static 0x54000000 0x0 44 8 48 12 "Macro"
;4 ComboBox 0x54230641 0x4 112 24 98 172 "Fun"
;6 ComboBox 0x54230641 0x4 216 24 98 172 "Auto"
;7 ComboBox 0x54230641 0x4 320 24 98 172 "item"
;8 Static 0x54000000 0x0 145 8 48 12 "Function"
;9 Static 0x54000000 0x0 249 8 48 12 "Autotext"
;10 Static 0x54000000 0x0 361 8 48 12 "Item"
;END DIALOG
;DIALOG EDITOR: "" 0x2040801 "*" "" "" ""
str controls = "3 4 6 7"
str cb3Mac cb4Fun cb6Aut cb7ite
cb3Mac=amac
cb4Fun=afun
cb6Aut=aaut
if(!ShowDialog(dd &sub.DlgProc &controls)) ret
#sub DlgProc
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,;CB_SelectString(id(3 hDlg) "test")
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
int hcb2=id(7 hDlg) ;;combo box
sel wParam
,case IDOK
,case IDCANCEL
,
,case CBN_SELENDOK<<16|6
,str cb1si
,_i=CB_SelectedItem(lParam cb1si)
,str cb2ii itemscb2=sub.gotoitemedit(cb1si)
,SendMessage(hcb2 CB_RESETCONTENT 0 0)
,itemscb2.findreplace(":sub." " ")
,itemscb2.findreplace(";;" " ")
,foreach cb2ii itemscb2
,,CB_Add(hcb2 cb2ii)
,
,case CBN_DBLCLK<<16|7
,str cb2t
,_i=CB_SelectedItem(lParam cb2t)
,_s.getwintext(id(6 hDlg))
,mac+ _s
,int c=GetQmCodeEditor
,SendMessage(c SCI.SCI_GOTOLINE _i+1 0)
,int ii=findrx(cb2t "Sub." 0 1)
,int cp=SendMessage(c SCI.SCI_GETCURRENTPOS 0 0)
,cp+ii
,SendMessage(c SCI.SCI_GOTOPOS cp 0)
,
,SendMessage(c SCI.SCI_SETSELBACK 0 0x00FF00)
,'SE
ret 1
#sub gotoitemedit
function~ ~name
str pattern="(?:.*\:sub\..*)"
_s.getmacro(name 0)
str ss d
int i
ARRAY(str) a
findrx(_s pattern 0 4 a)
for i 0 a.len
,d.formata("%s[]" a[0 i])
ret d.trim