Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to execute QM item in dialog
#2
All features have been completed,  Smile

My programming level is limited, only for the time being. I hope someone can suggest some improvements, thank you very much. Heart




Function Macro10
Code:
Copy      Help
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 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

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"
,
,SetTimer hDlg 1 10 0
,int he8=id(8 hDlg)
,SetProp he8 "wndproc" SubclassWindow(he8 &sub.EditSubclassProc8)

,
,;SetTimer hDlg 4 10 0
,;int he9=id(9 hDlg)
,;SetProp he9 "wndproc" SubclassWindow(he9 &sub.EditSubclassProc)
,
,SetTimer hDlg 2 10 0
,int he3=id(3 hDlg)
,SetProp he3 "wndproc" SubclassWindow(he3 &sub.EditSubclassProc3)
,
,SetTimer hDlg 3 10 0
,int he7=id(7 hDlg)
,SetProp he7 "wndproc" SubclassWindow(he7 &sub.EditSubclassProc7)
,
,case WM_DESTROY
,
,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 EditSubclassProc3
function# hWnd message wParam lParam

;OutWinMsg message wParam lParam
sel message
,case WM_DESTROY
,
,case WM_GETDLGCODE
,sel(wParam) 
,,case [VK_RETURN,VK_SPACE]
,,ret DLGC_WANTALLKEYS

,case [WM_KEYDOWN,WM_KEYUP]
,sel wParam
,,case [VK_DOWN,VK_UP,VK_PRIOR,VK_NEXT]
,,SendMessage id(4 GetParent(hWnd)) message wParam lParam
,,ret
,,case [VK_RETURN,VK_SPACE]
,,SendMessage GetParent(hWnd) WM_COMMAND LBN_DBLCLK<<16|4 hWnd
,,ret

int wndproc=GetProp(hWnd "wndproc"); if(!wndproc) ret
ret CallWindowProcW(wndproc hWnd message wParam lParam)

#sub EditSubclassProc7
function# hWnd message wParam lParam

;OutWinMsg message wParam lParam
sel message
,case WM_DESTROY
,
,case WM_GETDLGCODE
,sel(wParam) 
,,case [VK_RETURN,VK_SPACE]
,,ret DLGC_WANTALLKEYS

,case [WM_KEYDOWN,WM_KEYUP]
,sel wParam
,,case [VK_DOWN,VK_UP,VK_PRIOR,VK_NEXT]
,,SendMessage id(10 GetParent(hWnd)) message wParam lParam
,,ret
,,case [VK_RETURN,VK_SPACE]
,,SendMessage GetParent(hWnd) WM_COMMAND LBN_DBLCLK<<16|10 hWnd
,,ret

int wndproc=GetProp(hWnd "wndproc"); if(!wndproc) ret
ret CallWindowProcW(wndproc hWnd message wParam lParam)

#sub EditSubclassProc8
function# hWnd message wParam lParam

;OutWinMsg message wParam lParam
sel message
,case WM_DESTROY
,
,case WM_GETDLGCODE
,sel(wParam) 
,,case [VK_RETURN,VK_SPACE]
,,ret DLGC_WANTALLKEYS

,case [WM_KEYDOWN,WM_KEYUP]
,sel wParam
,,case [VK_DOWN,VK_UP,VK_PRIOR,VK_NEXT]
,,SendMessage id(11 GetParent(hWnd)) message wParam lParam
,,ret
,,case [VK_RETURN,VK_SPACE]
,,SendMessage GetParent(hWnd) WM_COMMAND LBN_DBLCLK<<16|11 hWnd
,,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


Messages In This Thread
How to execute QM item in dialog - by win - 04-20-2019, 09:44 PM
RE: How to execute QM item in dialog - by win - 04-25-2019, 01:49 AM
RE: How to execute QM item in dialog - by Kevin - 04-25-2019, 02:39 AM
RE: How to execute QM item in dialog - by win - 04-25-2019, 03:00 AM
RE: How to execute QM item in dialog - by Kevin - 04-25-2019, 05:11 AM
RE: How to execute QM item in dialog - by win - 04-25-2019, 05:13 AM
RE: How to execute QM item in dialog - by win - 04-25-2019, 06:17 AM
RE: How to execute QM item in dialog - by Kevin - 04-26-2019, 12:51 AM
RE: How to execute QM item in dialog - by win - 04-26-2019, 01:09 AM
RE: How to execute QM item in dialog - by win - 04-26-2019, 02:11 AM
RE: How to execute QM item in dialog - by win - 04-26-2019, 06:19 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)