Hi,
In the following post, the options for the ComboBox control are located in Function AID_sel
https://www.quickmacros.com/forum/showth...0#pid33100
Function AID_sel
I want to move these options into the subfunctions of the following Autotext AID_Test, Then, pass them as arguments to function PasteAutoInputDialog like the following code:
PasteAutoInputDialog(_s _sel)
how to modify the code of function AutoInputDialog and PasteAutoInputDialog, Implement this feature?
I found the following relevant code, but don't know how to modify it
Line 37-40 in AutoInputDialog
#ifdef AID_sel
c[i+1]=a[0 i]
AID_sel c[i+1]
#endif
Thanks in advance for any advice and help
david
Autotext AID_Test
Trigger $t
Function PasteAutoInputDialog
Function AutoInputDialog
In the following post, the options for the ComboBox control are located in Function AID_sel
https://www.quickmacros.com/forum/showth...0#pid33100
Function AID_sel
;/
function str&s
sel s
,case "$sel_Call$"
,s="Mrs[]Mr"
,
,case "$sel_Country$"
,s="United States[]United Kingdom[]France"
I want to move these options into the subfunctions of the following Autotext AID_Test, Then, pass them as arguments to function PasteAutoInputDialog like the following code:
PasteAutoInputDialog(_s _sel)
how to modify the code of function AutoInputDialog and PasteAutoInputDialog, Implement this feature?
I found the following relevant code, but don't know how to modify it
Line 37-40 in AutoInputDialog
#ifdef AID_sel
c[i+1]=a[0 i]
AID_sel c[i+1]
#endif
Thanks in advance for any advice and help
david
Autotext AID_Test
Trigger $t
/b/i/c/m
bbb :sub.Sub1 ;;aid test 1
#sub Sub1 m
IStringMap _sel._create
lpstr s=
;"$sel_Call$" "Mrs[]Mr"
;"$sel_Country$" "United States[]United Kingdom[]France"
_sel.AddList(s)
_s=
;Dear $sel_Call$,
;My name is $inp_Name$.
;Our office is at $sel_Country$
PasteAutoInputDialog(_s _sel)
Function PasteAutoInputDialog
;/
function $template
;Calls <help>AutoInputDialog</help> and pastes the text. Also sets caret if need.
;EXAMPLE
;_s=
;F
;;Dear Mr. $inp_Customer$,
;;
;;thank you for contacting us. The price is $$inp_Price$. Let's meet next $inp_Day$.
;;
;;Thanks and best regards,
;;$set_CaretHere$
;;
;;$var_ShortDate$
;;
;PasteAutoInputDialog(_s)
int nLeft
str s=AID_test(template nLeft)
;Indirectly solve the escaping problem (replace $cel with $sel)
s.findreplace("$cel" "$sel")
spe 10
paste s
if(nLeft) key L(#nLeft)
Function AutoInputDialog
;/
function'str $template [int&nLeft]
;Shows an auto-created dialog containing Edit and ComboBox controls specified in template text like $inp_Label$.
;Returns template text where these substrings are replaced with user input.
;Also can contain variables like $var_Name$ that are replaced by your callback function.
;REMARKS
;Special substrings:
;$inp_Label$ - creates an Edit control and static text Label.
;$sel_Label$ - creates a ComboBox control and static text Label. To get ComboBox items, calls your function named AID_sel. See examples there.
;$var_Name$ - calls your function named AID_var. See examples there.
;$set_CaretHere$ - removes and sets nLeft = the number of Left keys to move the caret (text cursor) here.
;$var_cur$ - removes and sets nLeft = the number of Left keys to move the caret (text cursor) here.
;On Cancel ends this thread.
;Example - code in function KeyAutoInputDialog.
;In scripts you'll probably use KeyAutoInputDialog, not this function. Use this function only to create functions similar to KeyAutoInputDialog, for example to use paste instead of key.
out
ARRAY(str) a
if(!findrx(template "\$(?:inp|sel)_(.+?)\$" 0 4 a)) ret template
ARRAY(str) c.create(a.len+1)
c[0]="3"
str dd
dd.formata("BEGIN DIALOG[]0 '''' 0x90C80AC8 0x0 0 0 224 %i ''Manual Text Input''[]" a.len*30+40)
int i idEdit(3) idStatic(503) y(8)
for i 0 a.len
,dd.formata("%i Static 0x54000000 0x0 8 %i 214 10 ''%s''[]%i " idStatic y a[1 i].escape(1) idEdit)
,sel a[0 i][1]
,,case 'i'
,,dd.formata("Edit 0x54030080 0x200 8 %i 208 13[]" y+12)
,,case 's'
,,dd.formata("ComboBox 0x54230242 0x0 8 %i 208 213[]" y+12)
#ifdef AID_sel
,,c[i+1]=a[0 i]
,,AID_sel c[i+1]
#endif
,if(i) c[0].formata(" %i" idEdit)
,y+30
,idEdit+1
,idStatic+1
y+10
dd.formata("1 Button 0x54030001 0x4 116 %i 48 14 ''OK''[]2 Button 0x54030000 0x4 168 %i 48 14 ''Cancel''[]END DIALOG" y y)
_s=c[0]
out _s
out dd
if(!ShowDialog(dd 0 &c[0])) end
str r
ARRAY(POINT) b
findrx(template "\$(?:inp|sel)_.+?\$" 0 4 b)
int j
for i 0 b.len
,POINT& p=b[0 i]
,r.geta(template j p.x-j)
,int u=0; if(template[p.x+1]='s') val(c[i+1] 0 u); u+1
,r+c[i+1]+u
,j=p.y
r.geta(template j)
#ifdef AID_var
REPLACERX k2.frepl=&sub.RRX
r.replacerx("\$var_\w+\$" k2)
#endif
if &nLeft
,nLeft=0
,;i=find(r "$var_cur$")
,i=find(r "$set_CaretHere$")
,if i>=0
,,r.remove(i 15)
,,for(i i r.len) if(r[i]!13) nLeft+1
ret r
#sub RRX
function# REPLACERXCB&x
AID_var(x.match)