04-19-2019, 12:18 AM
oh btw you have a few things that should be changed in your edit button code
your code will only work if sub function name is sub.sub1 sub.sub2 ect ect ect . If you have a subfunction not named that wont find it and your list will be off.
also there is no need to use a global variable and especially not one that has a local name in another subfunction
here is updated code
your code will only work if sub function name is sub.sub1 sub.sub2 ect ect ect . If you have a subfunction not named that wont find it and your list will be off.
also there is no need to use a global variable and especially not one that has a local name in another subfunction
here is updated code
;case 14 ;;Edit
_s.getwintext(id(5 hDlg))
str ssss items=sub.gotoitemedit(_s)
items.replacerx("\Q:sub.\E|\;" " ")
_i=ListDialog(items "Which item to Edit" "Select item")
if(_i=0) ret
mac+ _s
int c=GetQmCodeEditor
SendMessage(c SCI.SCI_GOTOLINE _i 0)
ssss.getl(items _i-1)
ssss.trim
int ii=find(ssss "Sub." 0 1)
int cp=SendMessage(c SCI.SCI_GETCURRENTPOS 0 0)
cp+ii
SendMessage(c SCI.SCI_GOTOPOS cp 0)
#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