01-17-2021, 01:37 AM
all of your code under case ID_OK should be moved. it isn't needed there as can do the same after the dialog closes
this is where it should be
Macro M3
Trigger A1
this is where it should be
Macro M3
Trigger A1
str pattern="(?:.*\:sub\..*)"
_s.getmacro("A1" 0)
str d
int i
ARRAY(str) a
findrx(_s pattern 0 4 a)
a.sort
for i 0 a.len
,d.formata("%s[]" a[0 i])
d.trim
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;3 ComboBox 0x54230641 0x0 8 8 96 122 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040B01 "*" "" "" ""
str controls = "3"
str cb3=d
if(!ShowDialog(dd &sub.DlgProc &controls)) ret
TO_CBGetItem(cb3)
out cb3
_s.getmacro("A1" 0)
int cp=findrx(_s cb3)
out cp
mac+ "A1"
int h=GetQmCodeEditor
SendMessage(h SCI.SCI_GOTOPOS cp 0)
SendMessage(h SCI.SCI_SETSEL cp cp+9)
#sub DlgProc
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1