@kevin
Thank you very much for your guidance , I will try it carefully.
The following is a modified code according to your instructions, very good
I just found a little problem,
The Enter key cannot be used on other windows, for example, creating a new macro
Macro code:
Mes "ok"
Then from the search box, use the Enter key to open it, then press Enter again, the pop-up window can not be closed
Function Macro11
Thank you very much for your guidance , I will try it carefully.
The following is a modified code according to your instructions, very good
I just found a little problem,
The Enter key cannot be used on other windows, for example, creating a new macro
Macro code:
Mes "ok"
Then from the search box, use the Enter key to open it, then press Enter again, the pop-up window can not be closed
Function Macro11
out
QMITEM q; int i
ARRAY(str) aaut amac afun
rep
,i=qmitem(-i 2 &q 1)
,if(i=0) break
,sel q.itype
,,case 0
,,amac[]=q.name
,,case 1
,,afun[]=q.name
,,case 4
,,aaut[]=q.name
str iamac=amac
str iafun=afun
str iaaut=aaut
str dd=
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 409 163 "Dialog"
;3 Edit 0x54030080 0x200 5 22 96 14 ""
;7 Edit 0x54030080 0x204 106 22 96 14 ""
;8 Edit 0x54030080 0x204 207 22 96 14 ""
;9 Edit 0x54030080 0x204 308 22 96 14 ""
;4 ListBox 0x54230101 0x200 5 37 96 120 "" "Double click Run the Macro[]Right click Open the Macro"
;10 ListBox 0x54230101 0x204 106 37 96 120 "" "Double click Run the Funtion[]Right click Open the Funtion"
;11 ListBox 0x54230101 0x204 207 37 96 120 "" "Double click Open the AutoText"
;12 ListBox 0x54230101 0x204 308 37 96 120 "" "Double click Open the AutoText item"
;6 Static 0x54000000 0x0 37 8 48 12 "Macro"
;13 Static 0x54000000 0x0 133 8 48 12 "Function"
;14 Static 0x54000000 0x0 238 8 48 12 "Autotext"
;15 Static 0x54000000 0x0 333 8 48 12 "AutoText item"
;END DIALOG
;DIALOG EDITOR: "" 0x2040801 "*" "" "" ""
str controls = "3 7 8 9 4 10 11 12"
str e3 e7 e8 e9 lb4 lb10 lb11 lb12
lb4=iamac
lb10=iafun
lb11=iaaut
if(!ShowDialog(dd &sub.DlgProc &controls)) ret
#sub DlgProc v
function# hDlg message wParam lParam
;messages
sel message
,case WM_INITDIALOG
,SendMessage id(3 hDlg) EM_SETCUEBANNER TRUE @"Search Macro"
,SendMessage id(7 hDlg) EM_SETCUEBANNER TRUE @"Search Function"
,SendMessage id(8 hDlg) EM_SETCUEBANNER TRUE @"Search AutoText"
,SendMessage id(9 hDlg) EM_SETCUEBANNER TRUE @"Search AutoText item"
,
,SetProp id(8 hDlg) "wndproc" SubclassWindow((id(8 hDlg)) &sub.EditSubclassProc)
,SetProp id(3 hDlg) "wndproc" SubclassWindow((id(3 hDlg)) &sub.EditSubclassProc)
,SetProp id(7 hDlg) "wndproc" SubclassWindow((id(7 hDlg)) &sub.EditSubclassProc)
,
,case WM_DESTROY
,RemoveProp id(8 hDlg) "wndproc" ;;remove prop on dialog close
,RemoveProp id(3 hDlg) "wndproc" ;;remove prop on dialog close
,RemoveProp id(7 hDlg) "wndproc" ;;remove prop on dialog close
,
,case WM_COMMAND goto messages2
,case WM_TIMER
,sel wParam
,,case 1
,,KillTimer hDlg wParam
,,goto giaaut
,,
,,;case 4
,,;KillTimer hDlg wParam
,,;goto giaati
,,
,,case 2
,,KillTimer hDlg wParam
,,goto giamac
,,
,,case 3
,,KillTimer hDlg wParam
,,goto giafun
ret
;messages2
int hlb12=id(12 hDlg)
sel wParam
,case EN_CHANGE<<16|8
,SetTimer hDlg 1 100 0
,
,;case EN_CHANGE<<16|9
,;SetTimer hDlg 4 100 0
,
,case EN_CHANGE<<16|3
,SetTimer hDlg 2 100 0
,
,case EN_CHANGE<<16|7
,SetTimer hDlg 3 100 0
,
,case LBN_DBLCLK<<16|4
,goto gShowSelected4
,
,case LBN_DBLCLK<<16|10
,goto gShowSelected10
,
,case LBN_DBLCLK<<16|11
,goto gShowSelected11
,
,case LBN_SELCHANGE<<16|11
,str lb11si
,_i=LB_SelectedItem(lParam lb11si)
,str lb12ii itemslb12=sub.gotoitemedit(lb11si)
,SendMessage(hlb12 LB_RESETCONTENT 0 0)
,itemslb12.findreplace(":sub.Sub" " ")
,itemslb12.findreplace(";;" " ")
,foreach lb12ii itemslb12
,,LB_Add(hlb12 lb12ii)
,
,case LBN_DBLCLK<<16|12
,str lb12t
,_i=LB_SelectedItem(lParam lb12t)
,LB_SelectedItem id(11 hDlg) _s
,;mes _s
,mac+ _s
,int c=GetQmCodeEditor
,SendMessage(c SCI.SCI_GOTOLINE _i+1 0)
,int ii=findrx(lb12t "\d" 0 1)
,int cp=SendMessage(c SCI.SCI_GETCURRENTPOS 0 0)
,cp+ii
,SendMessage(c SCI.SCI_GOTOPOS cp 0)
,
,case IDOK
,case IDCANCEL
ret 1
;giamac
int hlb4=id(4 hDlg)
SendMessage hlb4 LB_RESETCONTENT 0 0
str s4 sEdit4.getwintext(id(3 hDlg))
foreach s4 iamac
,if(sEdit4.len and find(s4 sEdit4 0 1)<0) continue
,LB_Add hlb4 s4
ret
;giafun
int hlb10=id(10 hDlg)
SendMessage hlb10 LB_RESETCONTENT 0 0
str s10 sEdit10.getwintext(id(7 hDlg))
foreach s10 iafun
,if(sEdit10.len and find(s10 sEdit10 0 1)<0) continue
,LB_Add hlb10 s10
ret
;giaaut
int hlb11=id(11 hDlg)
SendMessage hlb11 LB_RESETCONTENT 0 0
str s11 sEdit11.getwintext(id(8 hDlg))
foreach s11 iaaut
,if(sEdit11.len and find(s11 sEdit11 0 1)<0) continue
,LB_Add hlb11 s11
ret
;giaati
;SendMessage hlb12 LB_RESETCONTENT 0 0
;str s12 sEdit12.getwintext(id(9 hDlg))
;ARRAY(str) iaati
;iaati=???
;foreach s12 iaati
,;if(sEdit12.len and find(s12 sEdit11 0 1)<0) continue
,;LB_Add hlb12 s12
;ret
;gShowSelected4
hlb4=id(4 hDlg)
_i=LB_SelectedItem(hlb4)
LB_GetItemText hlb4 _i _s
mac _s
ret
;gShowSelected10
hlb10=id(10 hDlg)
_i=LB_SelectedItem(hlb10)
LB_GetItemText hlb10 _i _s
mac _s
ret
;gShowSelected11
hlb11=id(11 hDlg)
_i=LB_SelectedItem(hlb11)
LB_GetItemText hlb11 _i _s
mac+ _s
ret
#sub EditSubclassProc
function# hWnd message wParam lParam
int cid=GetDlgCtrlID(hWnd)
int Phwnd= GetParent(hWnd)
;OutWinMsg message wParam lParam
sel message
,case WM_DESTROY
,case WM_GETDLGCODE
,sel(wParam) case [VK_RETURN] ret DLGC_WANTALLKEYS
,case [WM_KEYDOWN,WM_KEYUP]
,sel wParam ;;virtual key code
,,case VK_RETURN
,,;on enter in the edit box select the item in the list box
,,sel cid
,,,case 3
,,,SendMessage Phwnd WM_COMMAND LBN_DBLCLK<<16|GetDlgCtrlID(id(4 Phwnd)) id(4 Phwnd)
,,,case 7
,,,SendMessage Phwnd WM_COMMAND LBN_DBLCLK<<16|GetDlgCtrlID(id(10 Phwnd)) id(10 Phwnd)
,,,case 8
,,,SendMessage Phwnd WM_COMMAND LBN_DBLCLK<<16|GetDlgCtrlID(id(11 Phwnd)) id(11 Phwnd)
,,ret
,,case [VK_DOWN,VK_UP,VK_PRIOR,VK_NEXT]
,,;relay these keys to the listbox and not to the edit box
,,sel cid
,,,case 3
,,,SendMessage id(4 Phwnd) message wParam lParam
,,,case 7
,,,SendMessage id(10 Phwnd) message wParam lParam
,,,case 8
,,,SendMessage id(11 Phwnd) message wParam lParam
,,ret
int wndproc=GetProp(hWnd "wndproc"); if(!wndproc) ret
ret CallWindowProcW(wndproc hWnd message wParam lParam)
#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