Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get a list of all AutoText files in the left pane
#91
try this
Code:
Copy      Help
,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=findrx(ssss "Sub." 0 1)
,int cp=SendMessage(c SCI.SCI_GETCURRENTPOS 0 0)
,cp+ii
,SendMessage(c SCI.SCI_GOTOPOS cp 0)
#92
Let the line where the cursor is located, highlight twice, then resume (Find function, you can make the field highlight, please see the picture below)

Can it be achieved? This will be more eye-catching


Attached Files Image(s)
   
#93
I found it in the link below, I can set the background color, but I don't know how to use it.


https://www.scintilla.org/ScintillaDoc.h...Definition


SCI_SETSELFORE(bool useSetting, colour fore)
SCI_SETSELBACK(bool useSetting, colour back)
You can choose to override the default selection colouring with these two messages. The colour you provide is used if you set

@kevin
If highlight the line (set the background color to yellow), it would be great.
Tongue

How to exchange positions, is it possible?
Like the picture below


Attached Files Image(s)
   
#94
I saw the following code in QM help, I think there should be a way to exchange the position of Sub* and Abbre, but I don't know how to use regular expressions.


 
Code:
Copy      Help
If need month, day and year:
ARRAY(str) a
i=findrx("file01-02-2000.txt" "(\d{2})-(\d{2})-(\d{4})" 0 0 a)
out a[0] ;;whole match
out a[1] ;;submatch 1 (month)
out a[2] ;;submatch 2 (day)
out a[3] ;;submatch 3 (year)
#95
@kevin

Use the code below to achieve the highlighted line 
Smile

int h=GetQmCodeEditor
SendMessage(h SCI.SCI_SETSELBACK 0 0x00FF00) 
'E SH


There is only one problem at the moment,

If an AutoText with a single line of text is defined, it cannot be displayed in the list, and the positioning is not accurate.
Huh

Is there a better way? Smile
#96
no dont use this

int h=GetQmCodeEditor
SendMessage(h SCI.SCI_SETSELBACK 0 0x00FF00) 
'E SH
 that will change the selection background color for everything in QM


i have a better code doesn't use selection at all
will post later.

see below how new method will work. Think this is what you really wanted

   
#97
Yes, this is what I want,  Tongue
 
How is this implemented, using a few lines of code? 


I am looking forward to using the shortest code  Big Grin
#98
Is there a better way to add comments? 

The word in the statement cannot be included in the comment, otherwise the comment will not be added 
Confused
#99
@kevin

The following code can be tested successfully, but I don't know how to use code to get rows, insert rows

 
Code:
Copy      Help
[size=large];Get line

str comment=" ;;this is comment"
str s="test :sub.Sub1"
int i=findrx(s ";;")
if(i<0)
,_s.from(s comment)
,mes _s

;Insert line[/size]
it essentially like that but a bit more complicated because of how the text is entered in qm.

Function Add_AutoText_Dialog_New
Trigger CSAa     Help - how to add the trigger to the macro
Code:
Copy      Help
out 
str s.getsel
QMITEM q; int i
ARRAY(str) atn
rep
,i=qmitem(-i 1|16 &q 1)
,if(i=0) break
,if q.itype=4
,,atn[]=q.name
_s=atn
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 360 208 "Add AutoText"
;3 Edit 0x54030080 0x200 64 8 287 16 "text" "• text that you must type to execute statements.[]• Can be used any characters, including spaces, tabs and line breaks.[]• Can be used escapesequences.[]"
;4 Edit 0x54231044 0x200 64 32 287 80 "Statements" "statements - []• Full text[]• any commands that you can use in macros.[]• To separate multiple statements, use semicolons.[]"
;9 Button 0x54012009 0x0 64 120 122 10 "Template for KeyAutoInputDialog" "Check here if statement is a Template for KeyAutoInputDialog"
;13 Button 0x54012009 0x0 248 120 103 10 "Multiline/Singleline Autotext" "Click here if statement is for multiline or singleline Autotext(default)"
;12 Edit 0x54030080 0x200 64 136 287 16 "" "A brief explanantion for a popup list when autotext has multiple items of the same Abbreviation[]or when Autotext confirmation option is set"
;5 ComboBox 0x54230242 0x0 64 160 135 213 ""
;6 Static 0x54000000 0x0 8 160 44 16 "Add to:"
;7 Static 0x54000000 0x4 8 8 48 16 "Abbreviation:"
;8 Static 0x54000000 0x4 8 32 44 16 "Statement:"
;11 Static 0x54000000 0x0 8 136 44 16 "Comment:"
;15 Button 0x44030F00 0x0 6 50 48 14 "+ inp_name"
;16 Button 0x44030F00 0x4 6 71 48 14 "+ sel_name"
;17 Button 0x44032000 0x4 6 92 48 14 "+ var_name"
;10 Button 0x54030000 0x4 240 184 48 14 "Add"
;2 Button 0x54030000 0x4 304 184 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040802 "*" "" "" ""

str controls = "3 4 9 13 12 5"
str e3tex e4Sta o9Tem o13Mul e12 cb5
if s.len
,e4Sta=s
o13Mul=1
cb5=_s
if(!ShowDialog(dd &sub.DlgProc &controls)) ret
str cbt
findrx(cb5 "\s[\x80-\xff]+|\s[a-zA-Z0-9]+" 0 1 cbt)
cbt.trim
str result=val(cb5)
if(result =-1)
,int ni=newitem(cbt "/b/i/c/m" "Autotext" "$t" "" 4)
str Abbreviation=iif((e3tex=" "or empty(e3tex)) "Text" e3tex) 
str comment=iif((e12=" "or empty(e12)) "Description" e12)
str statement=e4Sta
mac+ cbt
err
,mac+ ni
ARRAY(str) atl
if(numlines(statement) >1)
,atl=statement
,for i 0 atl.len
,,atl[i].from(" " atl[i])
,statement=atl
,statement.rtrim
,if(o13Mul=1)    
,,statement- "_s= []"
,,statement+ "[]paste _s"
,else
,,statement- "_s=[]F[]"
,,statement+ "[]PasteAutoInputDialog(_s)"        
else
,,if(o13Mul=1)
,,,statement- "''"
,,,statement+ "''"
,,else
,,,atl=statement
,,,for i 0 atl.len
,,,,atl[i].from(" " atl[i])
,,,statement=atl
,,,statement.rtrim
,,,statement- "_s=[]F[]"
,,,statement+ "[]PasteAutoInputDialog(_s)"            
int h=GetQmCodeEditor
SendMessage(h SCI.SCI_GOTOLINE 1 0)
InsertStatement(statement comment "" 2)
int r
if(result != -1)
,r=sub.GetInsertedTextCaretPosition(1)
else
,SendMessage(h SCI.SCI_GOTOLINE 1 0)
,r=SendMessage(h SCI.SCI_GETCURRENTPOS 0 0)
SendMessage(h SCI.SCI_SETSEL r r+4)
Abbreviation.setclip
SendMessage(h SCI.SCI_PASTE 0 0)
int cp=SendMessage(h SCI.SCI_GETCURRENTPOS 0 0)
sub.check_for_comment(cp h comment)
cp+7
SendMessage(h SCI.SCI_GOTOPOS cp 0)
#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,SendMessage id(3 hDlg) EM_SETCUEBANNER TRUE @"Enter Text"
,SendMessage id(4 hDlg) EM_SETCUEBANNER TRUE @"Enter Statements"    
,SendMessage id(12 hDlg) EM_SETCUEBANNER TRUE @"Enter Comment"
,SendMessage id(5 hDlg) CB_SETCUEBANNER 0 @"Select Autotext file to add text to"
,DT_SetAccelerators(hDlg "400 Az")
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case CBN_EDITCHANGE<<16|5
,sub.CB_AutoComplete lParam    
,case IDOK
,case IDCANCEL
,case 10 ;;Add
,DT_Ok hDlg
,case 13 ;;Multiline/Singlelin Autotext
,hid id(15 hDlg)
,hid id(16 hDlg)
,hid id(17 hDlg) 
,case 9 ;;Template for KeyAutoInputDialog
,hid- id(15 hDlg)
,hid- id(16 hDlg)
,hid- id(17 hDlg)
,case [15, 400];;+ inp_name
,_s.getsel(0 0 id(4 hDlg))
,if _s.len
,,str s.from("$inp_" _s "$")
,,s.setsel(0 id(4 hDlg))
,else
,,mes "You must first select  a word in the edit box"
,case 16 ;;+ sel_name
,str aid_sel=sub.Get_AID_sel_AID_var("sel")
,_i=ListDialog(aid_sel "Select an  option from the list below" "AID_sel")
,if(_i=0) ret
,aid_sel.getl(aid_sel _i-1)
,act id(4 hDlg)
,paste aid_sel
,case 17 ;;+ var_name
,str aid_var=sub.Get_AID_sel_AID_var("var")
,_i=ListDialog(aid_var "Select an  option from the list below" "AID_var")
,if(_i=0) ret
,aid_var.getl(aid_var _i-1)
,act id(4 hDlg)
,paste aid_var
ret 1

#sub GetInsertedTextCaretPosition
function# [flags] ;;flags: 1 go to that position
int c=GetQmCodeEditor
SendMessage(c SCI.SCI_UNDO 0 0)
int r=SendMessage(c SCI.SCI_GETCURRENTPOS 0 0)
SendMessage(c SCI.SCI_REDO 0 0)
if(flags&1) SendMessage(c SCI.SCI_GOTOPOS r 0)
ret r

#sub CB_AutoComplete
function hcb

ifk(B) ret
ifk(X) ret
str s ss; int i
s.getwintext(hcb)
if(s.len)
,i=CB_FindItem(hcb s)
,if(i>=0)
,,CB_GetItemText(hcb i ss)
,,if(ss.len>s.len)
,,,ss.setwintext(hcb)
,,,SendMessage(hcb CB_SETEDITSEL 0 ss.len<<16|s.len)
#sub Get_AID_sel_AID_var
function~ ~option 
str oName pattern
sel option
,case "sel"
,oName="AID_sel"
,pattern="\$(?:sel)_(.+?)\$"
,case "var"
,oName="AID_var"
,pattern="\$(?:var)_(.+?)\$"    
_s.getmacro(oName 0)
str ss d
int i
ARRAY(str) aid_S
foreach ss _s
,findrx(ss pattern 0 4 aid_S)
,for i 0 aid_S.len
,,d.formata("%s[]" aid_S[0 i])
ret d.trim

#sub check_for_comment
function curPos h ~comment 
str s ss
if(!h); h=GetQmCodeEditor
int line=SendMessage(h SCI.SCI_LINEFROMPOSITION curPos 0)
SendMessage(h SCI.SCI_GOTOLINE line 0) 
int sp=SendMessage(h SCI.SCI_POSITIONFROMLINE line 0);
int ep=SendMessage(h SCI.SCI_GETLINEENDPOSITION line 0)
int ll=ep-sp
s.fix(SendMessage(h SCI.SCI_GETLINE line s.all(ll+1)))
s.trim
if(findrx(s ";;") <0)
,ss.from(";;" comment)
,SendMessage(h SCI.SCI_GOTOPOS ep 0)
,SendMessage(h SCI.SCI_INSERTTEXT -1 ss)
wow !!!

The above code perfectly solves the problem of comments! Heart

Can you add the flashing code to the line where the cursor is located? Tongue
lol yeah forgot about that

there ya go complete with flashing

Function Add_AutoText_Dialog_New
Trigger CSAa     Help - how to add the trigger to the macro
Code:
Copy      Help
out 
str s.getsel
QMITEM q; int i
ARRAY(str) atn
rep
,i=qmitem(-i 1|16 &q 1)
,if(i=0) break
,if q.itype=4
,,atn[]=q.name
_s=atn
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 360 208 "Add AutoText"
;3 Edit 0x54030080 0x200 64 8 287 16 "text" "• text that you must type to execute statements.[]• Can be used any characters, including spaces, tabs and line breaks.[]• Can be used escapesequences.[]"
;4 Edit 0x54231044 0x200 64 32 287 80 "Statements" "statements - []• Full text[]• any commands that you can use in macros.[]• To separate multiple statements, use semicolons.[]"
;9 Button 0x54012009 0x0 64 120 122 10 "Template for KeyAutoInputDialog" "Check here if statement is a Template for KeyAutoInputDialog"
;13 Button 0x54012009 0x0 248 120 103 10 "Multiline/Singleline Autotext" "Click here if statement is for multiline or singleline Autotext(default)"
;12 Edit 0x54030080 0x200 64 136 287 16 "" "A brief explanantion for a popup list when autotext has multiple items of the same Abbreviation[]or when Autotext confirmation option is set"
;5 ComboBox 0x54230242 0x0 64 160 135 213 ""
;6 Static 0x54000000 0x0 8 160 44 16 "Add to:"
;7 Static 0x54000000 0x4 8 8 48 16 "Abbreviation:"
;8 Static 0x54000000 0x4 8 32 44 16 "Statement:"
;11 Static 0x54000000 0x0 8 136 44 16 "Comment:"
;15 Button 0x44030F00 0x0 6 50 48 14 "+ inp_name"
;16 Button 0x44030F00 0x4 6 71 48 14 "+ sel_name"
;17 Button 0x44032000 0x4 6 92 48 14 "+ var_name"
;10 Button 0x54030000 0x4 240 184 48 14 "Add"
;2 Button 0x54030000 0x4 304 184 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040802 "*" "" "" ""

str controls = "3 4 9 13 12 5"
str e3tex e4Sta o9Tem o13Mul e12 cb5
if s.len
,e4Sta=s
o13Mul=1
cb5=_s
if(!ShowDialog(dd &sub.DlgProc &controls)) ret
str cbt
findrx(cb5 "\s[\x80-\xff]+|\s[a-zA-Z0-9]+" 0 1 cbt)
cbt.trim
str result=val(cb5)
if(result =-1)
,int ni=newitem(cbt "/b/i/c/m" "Autotext" "$t" "" 4)
str Abbreviation=iif((e3tex=" "or empty(e3tex)) "Text" e3tex) 
str comment=iif((e12=" "or empty(e12)) "Description" e12)
str statement=e4Sta
mac+ cbt
err
,mac+ ni
ARRAY(str) atl
if(numlines(statement) >1)
,atl=statement
,for i 0 atl.len
,,atl[i].from(" " atl[i])
,statement=atl
,statement.rtrim
,if(o13Mul=1)    
,,statement- "_s= []"
,,statement+ "[]paste _s"
,else
,,statement- "_s=[]F[]"
,,statement+ "[]PasteAutoInputDialog(_s)"        
else
,,if(o13Mul=1)
,,,statement- "''"
,,,statement+ "''"
,,else
,,,atl=statement
,,,for i 0 atl.len
,,,,atl[i].from(" " atl[i])
,,,statement=atl
,,,statement.rtrim
,,,statement- "_s=[]F[]"
,,,statement+ "[]PasteAutoInputDialog(_s)"            
int h=GetQmCodeEditor
SendMessage(h SCI.SCI_GOTOLINE 1 0)
InsertStatement(statement comment "" 2)
int r
if(result != -1)
,r=sub.GetInsertedTextCaretPosition(1)
else
,SendMessage(h SCI.SCI_GOTOLINE 1 0)
,r=SendMessage(h SCI.SCI_GETCURRENTPOS 0 0)
SendMessage(h SCI.SCI_SETSEL r r+4)
Abbreviation.setclip
SendMessage(h SCI.SCI_PASTE 0 0)
int cp=SendMessage(h SCI.SCI_GETCURRENTPOS 0 0)
sub.check_for_comment(cp h comment)
cp+7
SendMessage(h SCI.SCI_GOTOPOS cp 0)
sub.FlashCodeLine(cp h)
#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,SendMessage id(3 hDlg) EM_SETCUEBANNER TRUE @"Enter Text"
,SendMessage id(4 hDlg) EM_SETCUEBANNER TRUE @"Enter Statements"    
,SendMessage id(12 hDlg) EM_SETCUEBANNER TRUE @"Enter Comment"
,SendMessage id(5 hDlg) CB_SETCUEBANNER 0 @"Select Autotext file to add text to"
,DT_SetAccelerators(hDlg "400 Az")
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case CBN_EDITCHANGE<<16|5
,sub.CB_AutoComplete lParam    
,case IDOK
,case IDCANCEL
,case 10 ;;Add
,DT_Ok hDlg
,case 13 ;;Multiline/Singlelin Autotext
,hid id(15 hDlg)
,hid id(16 hDlg)
,hid id(17 hDlg) 
,case 9 ;;Template for KeyAutoInputDialog
,hid- id(15 hDlg)
,hid- id(16 hDlg)
,hid- id(17 hDlg)
,case [15, 400];;+ inp_name
,_s.getsel(0 0 id(4 hDlg))
,if _s.len
,,str s.from("$inp_" _s "$")
,,s.setsel(0 id(4 hDlg))
,else
,,mes "You must first select  a word in the edit box"
,case 16 ;;+ sel_name
,str aid_sel=sub.Get_AID_sel_AID_var("sel")
,_i=ListDialog(aid_sel "Select an  option from the list below" "AID_sel")
,if(_i=0) ret
,aid_sel.getl(aid_sel _i-1)
,act id(4 hDlg)
,paste aid_sel
,case 17 ;;+ var_name
,str aid_var=sub.Get_AID_sel_AID_var("var")
,_i=ListDialog(aid_var "Select an  option from the list below" "AID_var")
,if(_i=0) ret
,aid_var.getl(aid_var _i-1)
,act id(4 hDlg)
,paste aid_var
ret 1

#sub GetInsertedTextCaretPosition
function# [flags] ;;flags: 1 go to that position
int c=GetQmCodeEditor
SendMessage(c SCI.SCI_UNDO 0 0)
int r=SendMessage(c SCI.SCI_GETCURRENTPOS 0 0)
SendMessage(c SCI.SCI_REDO 0 0)
if(flags&1) SendMessage(c SCI.SCI_GOTOPOS r 0)
ret r

#sub CB_AutoComplete
function hcb

ifk(B) ret
ifk(X) ret
str s ss; int i
s.getwintext(hcb)
if(s.len)
,i=CB_FindItem(hcb s)
,if(i>=0)
,,CB_GetItemText(hcb i ss)
,,if(ss.len>s.len)
,,,ss.setwintext(hcb)
,,,SendMessage(hcb CB_SETEDITSEL 0 ss.len<<16|s.len)
#sub Get_AID_sel_AID_var
function~ ~option 
str oName pattern
sel option
,case "sel"
,oName="AID_sel"
,pattern="\$(?:sel)_(.+?)\$"
,case "var"
,oName="AID_var"
,pattern="\$(?:var)_(.+?)\$"    
_s.getmacro(oName 0)
str ss d
int i
ARRAY(str) aid_S
foreach ss _s
,findrx(ss pattern 0 4 aid_S)
,for i 0 aid_S.len
,,d.formata("%s[]" aid_S[0 i])
ret d.trim

#sub check_for_comment
function curPos h ~comment 
str s ss
if(!h); h=GetQmCodeEditor
int line=SendMessage(h SCI.SCI_LINEFROMPOSITION curPos 0)
SendMessage(h SCI.SCI_GOTOLINE line 0) 
int sp=SendMessage(h SCI.SCI_POSITIONFROMLINE line 0);
int ep=SendMessage(h SCI.SCI_GETLINEENDPOSITION line 0)
int ll=ep-sp
s.fix(SendMessage(h SCI.SCI_GETLINE line s.all(ll+1)))
s.trim
if(findrx(s ";;") <0)
,ss.from(";;" comment)
,SendMessage(h SCI.SCI_GOTOPOS ep 0)
,SendMessage(h SCI.SCI_INSERTTEXT -1 ss)

#sub FlashCodeLine
function curPos hce
if(!hce) hce=GetQmCodeEditor
int indicator=9
int line=SendMessage(hce SCI.SCI_LINEFROMPOSITION curPos 0)
SendMessage(hce SCI.SCI_SETINDICATORCURRENT indicator 0)
SendMessage(hce SCI.SCI_INDICSETALPHA indicator 100)
SendMessage(hce SCI.SCI_INDICSETFORE indicator 0x00FF00)
SendMessage(hce SCI.SCI_INDICSETSTYLE indicator SCI.INDIC_STRAIGHTBOX)
SendMessage(hce SCI.SCI_INDICSETUNDER indicator TRUE)
int lsp=SendMessage(hce SCI.SCI_POSITIONFROMLINE line 0)
int lep=SendMessage(hce SCI.SCI_GETLINEENDPOSITION line 0)
rep 4
,SendMessage(hce SCI.SCI_INDICATORFILLRANGE lsp lep-lsp)
,0.25
,SendMessage(hce SCI.SCI_INDICATORCLEARRANGE lsp lep-lsp)
,0.25
SendMessage(hce SCI.SCI_SETINDICATORCURRENT 0 0)
Wow!  Very good!!!   Wink

This is a very successful case  Cool

it shows a functional requirement, how to come from nothing, thanks for Gintaras, kevin, Ron and everyone in the forum. Heart
@kevin
The following code for Autotext item management. It is useful when there are many items in the Autotext.

I can filters Autotext . I can use Arrow key selection , Enter key or double-click to open the AutoText.

But I don't know how to add filtering to AutoText items.  The items is always changing

In addition, if I Enter some acronyms for AutoText in the edit box of the AutoText item, a menu will pop up, how to disable it.



Macro AT item mg
Code:
Copy      Help
out
QMITEM q; int i
ARRAY(str) aaut
rep
,i=qmitem(-i 2 &q 1)
,if(i=0) break
,sel q.itype
,,case 4
,,aaut[]=q.name
str asaut=aaut

str dd=
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 212 178 "AT item mg"
;8 Edit 0x54030080 0x204 7 22 96 14 ""
;9 Edit 0x54030080 0x204 108 22 96 14 ""
;11 ListBox 0x54230101 0x204 7 37 96 120 ""
;12 ListBox 0x54230101 0x204 108 37 96 120 ""
;14 Static 0x54000000 0x0 38 8 48 12 "AutoText"
;15 Static 0x54000000 0x0 133 8 48 12 "AutoText item"
;16 Static 0x54000000 0x0 27 163 168 12 "AutoText And item: Enter or Double click to Open"
;END DIALOG
;DIALOG EDITOR: "" 0x2040801 "*" "" "" ""

str controls = "8 9 11 12"
str e8 e9 lb11 lb12
lb11=asaut ;;autotext list

if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc v
function# hDlg message wParam lParam

;messages
sel message
,case WM_INITDIALOG
,SetProp id(8 hDlg) "wndproc" SubclassWindow((id(8 hDlg)) &sub.EditSubclassProc) ;;E8 Use arrow keys
,
,case WM_DESTROY
,RemoveProp id(8 hDlg) "wndproc" ;;remove prop on dialog close
,
,case WM_COMMAND goto messages2
,case WM_TIMER
,sel wParam
,,case 1 ;;e8 autotext filter to lb11
,,KillTimer hDlg wParam
,,int hlb11=id(11 hDlg)
,,SendMessage hlb11 LB_RESETCONTENT 0 0
,,str s8 se8.getwintext(id(8 hDlg)) 
,,foreach s8 lb11
,,,if(se8.len and find(s8 se8 0 1)<0) continue
,,,LB_Add hlb11 s8
ret

;messages2
sel wParam
,case EN_CHANGE<<16|8 ;;e8 autotext
,SetTimer hDlg 1 100 0
,
,case LBN_DBLCLK<<16|11 ;;lb11 autotext open
,hlb11=id(11 hDlg)
,LB_SelectedItem(hlb11 _s)
,mac+ _s
,
,case LBN_SELCHANGE<<16|11 ;;lb11 autotext item show
,str slb11
,LB_SelectedItem(lParam slb11)
,str slb12 aslb12=sub.gotoitemedit(slb11)
,;mes aslb12
,int hlb12=id(12 hDlg) 
,SendMessage(hlb12 LB_RESETCONTENT 0 0)
,aslb12.findreplace(":sub.Sub" "   ")
,aslb12.findreplace(";;" "   ")
,;mes aslb12
,foreach slb12 aslb12
,,LB_Add(hlb12 slb12)
,
,case LBN_DBLCLK<<16|12 ;;lb12 autotext item open
,str _slb12 _slb11
,_i=LB_SelectedItem(lParam _slb12)
,LB_SelectedItem id(11 hDlg) _slb11 
,mac+ _slb11
,int hQCE=GetQmCodeEditor
,SendMessage(hQCE SCI.SCI_GOTOLINE _i+1 0)
,int i=findrx(_slb12 "\d" 0 1)
,int cp=SendMessage(hQCE SCI.SCI_GETCURRENTPOS 0 0)
,cp+i+2
,SendMessage(hQCE SCI.SCI_GOTOPOS cp 0)
,
,case IDOK
,case IDCANCEL
ret 1

#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 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 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
try this think this covers it all. OH By the way regex has been improved finds all autotext now.



Function Dialog_Edit_Autotext
Code:
Copy      Help
out
str s.getsel
QMITEM q; int i
ARRAY(str) atn
rep
,i=qmitem(-i 1|16 &q 1)
,if(i=0) break
,if q.itype=4
,,atn[]=q.name
str- sItems=atn

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 334 188 "Edit Existing AutoText"
;3 Edit 0x54030080 0x200 9 8 120 14 ""
;4 ListBox 0x54230101 0x200 9 22 120 157 ""
;5 Edit 0x54030080 0x200 145 8 174 14 ""
;6 ListBox 0x54230101 0x200 145 22 174 157 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2040802 "*" "" "" ""

str controls = "3 4 5 6"
str e3 lb4 e5 lb6
lb4=sItems
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc v
function# hDlg message wParam lParam
str- itemslb2
int- lb6lc
sel message
,case WM_INITDIALOG
,SetProp id(3 hDlg) "wndproc" SubclassWindow((id(3 hDlg)) &sub.EditSubclassProc)
,SetProp id(5 hDlg) "wndproc" SubclassWindow((id(5 hDlg)) &sub.EditSubclassProc)
,case WM_DESTROY
,RemoveProp id(3 hDlg) "wndproc"
,RemoveProp id(5 hDlg) "wndproc"    
,case WM_COMMAND goto messages2
,case WM_TIMER
,sel wParam
,,case 1
,,KillTimer hDlg wParam
,,int hlb=id(4 hDlg)
,,SendMessage hlb LB_RESETCONTENT 0 0
,,str s3 sEdit3.getwintext(id(3 hDlg))
,,foreach s3 sItems
,,,if(sEdit3.len and find(s3 sEdit3 0 1)<0) continue
,,,LB_Add hlb s3
,,int count=LB_GetCount(hlb)
,,if count=1
,,,LB_SelectItem(hlb 0)
,,case 2
,,KillTimer hDlg wParam
,,int hlb2a=id(6 hDlg)
,,SendMessage hlb2a LB_RESETCONTENT 0 0
,,str s5 sEdit5.getwintext(id(5 hDlg))
,,foreach s5 itemslb2
,,,if(sEdit5.len and find(s5 sEdit5 0 1)<0) continue
,,,LB_Add hlb2a s5
,,int count2=LB_GetCount(hlb2a)
,,if count2=1
,,,LB_SelectItem(hlb2a 0)    

ret
;messages2
int h=GetQmCodeEditor
int hlb2=id(6 hDlg) ;;list box 2
sel wParam
,case IDOK
,case IDCANCEL
,case EN_CHANGE<<16|3
,SetTimer hDlg 1 100 0
,case EN_CHANGE<<16|5
,str lb4ta
,_i=LB_SelectedItem(id(4 hDlg) lb4ta)
,if _i
,,dis+ lb4ta
,SetTimer hDlg 2 100 0    
,case LBN_SELCHANGE<<16|4
,str lb1si
,_i=LB_SelectedItem(lParam lb1si)
,if(_i=-1)
,,LB_SelectItem(lParam 0)
,,_i=LB_SelectedItem(lParam lb1si)
,str lb2ii 
,itemslb2=sub.gotoitemedit(lb1si)
,SendMessage(hlb2 LB_RESETCONTENT 0 0)
,itemslb2.findreplace(":sub." "     ")
,itemslb2.findreplace(";;" "     ")
,itemslb2.findreplace(":" "     ")
,foreach lb2ii itemslb2
,,LB_Add(hlb2 lb2ii)    
,lb6lc=LB_GetCount(hlb2)
,case LBN_DBLCLK<<16|6
,str lb2t
,_i=LB_SelectedItem(lParam lb2t)
,if(_i=-1)
,,LB_SelectItem(lParam 0)
,,_i=LB_SelectedItem(lParam lb2t)
,int lb6ic=LB_GetCount(lParam)
,if(lb6ic<>lb6lc)
,,ARRAY(str) b=itemslb2
,,for i 0 b.len
,,,if(StrCompare(b[i] lb2t)=0)
,,,,_i=i
,,,,break
,LB_SelectedItem(id(4 hDlg)  _s)
,mac+ _s
,SendMessage(h SCI.SCI_GOTOLINE _i+1 0)
,int ii=findrx(lb2t "Sub." 0 1)
,if ii!=-1
,,int cp=SendMessage(h SCI.SCI_GETCURRENTPOS 0 0)
,,cp+ii
,,SendMessage(h SCI.SCI_GOTOPOS cp 0)
,sub.FlashCodeLine(_i+1 h)
,case EN_KILLFOCUS<<16|5
,str lb4tb
,_i=LB_SelectedItem(id(4 hDlg) lb4tb)
,if _i
,,dis- lb4tb
ret 1

#sub gotoitemedit
function~ ~name
str pattern="(?m)^(.+\:.+)"
_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

#sub FlashCodeLine
function line hce
if(!hce) hce=GetQmCodeEditor
int indicator=9
SendMessage(hce SCI.SCI_SETINDICATORCURRENT indicator 0)
SendMessage(hce SCI.SCI_INDICSETALPHA indicator 100)
SendMessage(hce SCI.SCI_INDICSETFORE indicator 0x00FF00)
SendMessage(hce SCI.SCI_INDICSETSTYLE indicator SCI.INDIC_STRAIGHTBOX)
SendMessage(hce SCI.SCI_INDICSETUNDER indicator TRUE)
int lsp=SendMessage(hce SCI.SCI_POSITIONFROMLINE line 0)
int lep=SendMessage(hce SCI.SCI_GETLINEENDPOSITION line 0)
rep 4
,SendMessage(hce SCI.SCI_INDICATORFILLRANGE lsp lep-lsp)
,0.25
,SendMessage(hce SCI.SCI_INDICATORCLEARRANGE lsp lep-lsp)
,0.25
SendMessage(hce SCI.SCI_SETINDICATORCURRENT 0 0)

#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]
,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_SELCHANGE<<16|GetDlgCtrlID(id(4 Phwnd)) id(4 Phwnd)
,,,case 5
,,,SendMessage Phwnd WM_COMMAND LBN_DBLCLK<<16|GetDlgCtrlID(id(6 Phwnd)) id(6 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 5
,,,SendMessage id(6 Phwnd) message wParam lParam            
,,ret

int wndproc=GetProp(hWnd "wndproc"); if(!wndproc) ret
ret CallWindowProcW(wndproc hWnd message wParam lParam)
I added the following code 

Enter directly on the edit box (e3) , unable to open the first Item,

Double click can open Item succeed

In addition, there is always an extra alarm sound Huh  When I press Enter on the AutoText item, it will sound, and when it is positioned in the file, it will sound again.

 
Code:
Copy      Help
 
case LBN_DBLCLK<<16|4
_i=LB_SelectedItem(lParam _s)
mac+ _s
actually it does open the item just not how you think. It opens it in listbox 6. the sound is because the subclassing, fixed below

Function Dialog_Edit_Autotext
Code:
Copy      Help
out
QMITEM q; int i
ARRAY(str) atn
rep
,i=qmitem(-i 1|16 &q 1)
,if(i=0) break
,if q.itype=4
,,atn[]=q.name
str- sItems=atn

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 334 188 "Edit Existing AutoText"
;3 Edit 0x54030080 0x200 9 8 120 14 ""
;4 ListBox 0x54230101 0x200 9 22 120 157 ""
;5 Edit 0x54030080 0x200 145 8 174 14 ""
;6 ListBox 0x54230101 0x200 145 22 174 157 ""
;1 Button 0x54030001 0x4 116 200 48 14 "OK"
;2 Button 0x54030000 0x4 168 200 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040802 "*" "" "" ""

str controls = "3 4 5 6"
str e3 lb4 e5 lb6
lb4=sItems
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam
str- itemslb2
int- lb6lc
str- sItems
int i
sel message
,case WM_INITDIALOG
,SetProp id(3 hDlg) "wndproc" SubclassWindow((id(3 hDlg)) &sub.EditSubclassProc)
,SetProp id(5 hDlg) "wndproc" SubclassWindow((id(5 hDlg)) &sub.EditSubclassProc)
,case WM_DESTROY
,RemoveProp id(3 hDlg) "wndproc"
,RemoveProp id(5 hDlg) "wndproc"    
,case WM_COMMAND goto messages2
,case WM_TIMER
,sel wParam
,,case 1
,,KillTimer hDlg wParam
,,int hlb=id(4 hDlg)
,,SendMessage hlb LB_RESETCONTENT 0 0
,,str s3 sEdit3.getwintext(id(3 hDlg))
,,foreach s3 sItems
,,,if(sEdit3.len and find(s3 sEdit3 0 1)<0) continue
,,,LB_Add hlb s3
,,int count=LB_GetCount(hlb)
,,if count=1
,,,SendMessage hDlg WM_COMMAND LBN_SELCHANGE<<16|GetDlgCtrlID(id(4 hDlg)) id(4 hDlg)
,,,;LB_SelectItem(hlb 0)
,,case 2
,,KillTimer hDlg wParam
,,int hlb2a=id(6 hDlg)
,,SendMessage hlb2a LB_RESETCONTENT 0 0
,,str s5 sEdit5.getwintext(id(5 hDlg))
,,foreach s5 itemslb2
,,,if(sEdit5.len and find(s5 sEdit5 0 1)<0) continue
,,,LB_Add hlb2a s5
,,int count2=LB_GetCount(hlb2a)
,,if count2=1
,,,LB_SelectItem(hlb2a 0)    
ret
;messages2
int h=GetQmCodeEditor
int hlb2=id(6 hDlg) ;;list box 2
sel wParam
,case IDOK
,case IDCANCEL
,case EN_CHANGE<<16|3
,SetTimer hDlg 1 100 0
,case EN_CHANGE<<16|5
,str lb4ta
,_i=LB_SelectedItem(id(4 hDlg) lb4ta)
,if _i
,,dis+ lb4ta
,SetTimer hDlg 2 100 0    
,case LBN_SELCHANGE<<16|4
,str lb1si
,_i=LB_SelectedItem(lParam lb1si)
,if(_i=-1)
,,LB_SelectItem(lParam 0)
,,_i=LB_SelectedItem(lParam lb1si)
,str lb2ii 
,itemslb2=sub.gotoitemedit(lb1si)
,SendMessage(hlb2 LB_RESETCONTENT 0 0)
,itemslb2.findreplace(":sub." "     ")
,itemslb2.findreplace(";;" "     ")
,itemslb2.findreplace(":" "     ")
,foreach lb2ii itemslb2
,,LB_Add(hlb2 lb2ii)    
,lb6lc=LB_GetCount(hlb2)
,case LBN_DBLCLK<<16|4
,_i=LB_SelectedItem(lParam _s)
,mac+ _s    
,case LBN_DBLCLK<<16|6
,str lb2t
,_i=LB_SelectedItem(lParam lb2t)
,if(_i=-1)
,,LB_SelectItem(lParam 0)
,,_i=LB_SelectedItem(lParam lb2t)
,int lb6ic=LB_GetCount(lParam)
,if(lb6ic<>lb6lc)
,,ARRAY(str) b=itemslb2
,,for i 0 b.len
,,,if(StrCompare(b[i] lb2t)=0)
,,,,_i=i
,,,,break
,LB_SelectedItem(id(4 hDlg)  _s)
,mac+ _s
,SendMessage(h SCI.SCI_GOTOLINE _i+1 0)
,int ii=findrx(lb2t "Sub." 0 1)
,if ii!=-1
,,int cp=SendMessage(h SCI.SCI_GETCURRENTPOS 0 0)
,,cp+ii
,,SendMessage(h SCI.SCI_GOTOPOS cp 0)
,sub.FlashCodeLine(_i+1 h)
,case EN_KILLFOCUS<<16|5
,str lb4tb
,_i=LB_SelectedItem(id(4 hDlg) lb4tb)
,if _i
,,dis- lb4tb
,,
ret 1

#sub gotoitemedit
function~ ~name
str pattern="(?m)^(.+\s\:.+)"
_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

#sub FlashCodeLine
function line hce
if(!hce) hce=GetQmCodeEditor
int indicator=9
SendMessage(hce SCI.SCI_SETINDICATORCURRENT indicator 0)
SendMessage(hce SCI.SCI_INDICSETALPHA indicator 100)
SendMessage(hce SCI.SCI_INDICSETFORE indicator 0x00FF00)
SendMessage(hce SCI.SCI_INDICSETSTYLE indicator SCI.INDIC_STRAIGHTBOX)
SendMessage(hce SCI.SCI_INDICSETUNDER indicator TRUE)
int lsp=SendMessage(hce SCI.SCI_POSITIONFROMLINE line 0)
int lep=SendMessage(hce SCI.SCI_GETLINEENDPOSITION line 0)
rep 4
,SendMessage(hce SCI.SCI_INDICATORFILLRANGE lsp lep-lsp)
,0.25
,SendMessage(hce SCI.SCI_INDICATORCLEARRANGE lsp lep-lsp)
,0.25
SendMessage(hce SCI.SCI_SETINDICATORCURRENT 0 0)

#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_CHAR
,sel wParam
,,case VK_RETURN
,,sel cid
,,,case [3,5]
,,,ret 0
,case WM_KEYDOWN
,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_SELCHANGE<<16|GetDlgCtrlID(id(4 Phwnd)) id(4 Phwnd)
,,,case 5
,,,SendMessage Phwnd WM_COMMAND LBN_DBLCLK<<16|GetDlgCtrlID(id(6 Phwnd)) id(6 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 5
,,,SendMessage id(6 Phwnd) message wParam lParam            
,,ret

int wndproc=GetProp(hWnd "wndproc"); if(!wndproc) ret
ret CallWindowProcW(wndproc hWnd message wParam lParam)
Still can't use the Enter key to open the item in the list on the left side of the dialog
The edit 3 control is programmed to open at items in list box 6. The main point of edit 3 and listbox 4 is to open the it autotext items in listbox 6.You already have double click to open the auto text function. It's redundant. And counter intuitive to what the edit control does.
A list of AutoText will pop up in the edit box


Attached Files Image(s)
   
only 1 way to address that fully and that is to disable all auto text while that dialog is open.
Is there a way to use the Enter key in edit box 5 to execute an AutoText item instead of opening it? Idea

I didn't find a way to execute an AutoText item.

is it possible?

First all disabled, finally enabled again?
Shy
this will take care of the autotex  triggering while the dialog is open  and will enable all autotext triggers when dialog closes

Function Dialog_Edit_Autotext
Code:
Copy      Help
out
str- sItems        
sub.DisableEnableAutoText(1 sItems)         

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 334 188 "Edit Existing AutoText"
;3 Edit 0x54030080 0x200 9 8 120 14 ""
;4 ListBox 0x54230101 0x200 9 22 120 157 ""
;5 Edit 0x54030080 0x200 145 8 174 14 ""
;6 ListBox 0x54230101 0x200 145 22 174 157 ""
;1 Button 0x54030001 0x4 116 200 48 14 "OK"
;2 Button 0x54030000 0x4 168 200 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040802 "*" "" "" ""

str controls = "3 4 5 6"
str e3 lb4 e5 lb6
lb4=sItems
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam
str- itemslb2
int- lb6lc
str- sItems
int i
sel message
,case WM_INITDIALOG
,SetProp id(3 hDlg) "wndproc" SubclassWindow((id(3 hDlg)) &sub.EditSubclassProc)
,SetProp id(5 hDlg) "wndproc" SubclassWindow((id(5 hDlg)) &sub.EditSubclassProc)
,case WM_DESTROY
,RemoveProp id(3 hDlg) "wndproc"
,RemoveProp id(5 hDlg) "wndproc"    
,case WM_COMMAND goto messages2
,case WM_TIMER
,sel wParam
,,case 1
,,KillTimer hDlg wParam
,,int hlb=id(4 hDlg)
,,SendMessage hlb LB_RESETCONTENT 0 0
,,str s3 sEdit3.getwintext(id(3 hDlg))
,,foreach s3 sItems
,,,if(sEdit3.len and find(s3 sEdit3 0 1)<0) continue
,,,LB_Add hlb s3
,,int count=LB_GetCount(hlb)
,,if count=1
,,,SendMessage hDlg WM_COMMAND LBN_SELCHANGE<<16|GetDlgCtrlID(id(4 hDlg)) id(4 hDlg)
,,,;LB_SelectItem(hlb 0)
,,case 2
,,KillTimer hDlg wParam
,,int hlb2a=id(6 hDlg)
,,SendMessage hlb2a LB_RESETCONTENT 0 0
,,str s5 sEdit5.getwintext(id(5 hDlg))
,,foreach s5 itemslb2
,,,if(sEdit5.len and find(s5 sEdit5 0 1)<0) continue
,,,LB_Add hlb2a s5
,,int count2=LB_GetCount(hlb2a)
,,if count2=1
,,,LB_SelectItem(hlb2a 0)    
ret
;messages2
int h=GetQmCodeEditor
int hlb2=id(6 hDlg) ;;list box 2
sel wParam
,case IDOK
,sub.DisableEnableAutoText(2)
,case IDCANCEL
,sub.DisableEnableAutoText(3)
,case EN_CHANGE<<16|3
,SetTimer hDlg 1 100 0
,case EN_CHANGE<<16|5
,SetTimer hDlg 2 100 0    
,case LBN_SELCHANGE<<16|4
,str lb1si
,_i=LB_SelectedItem(lParam lb1si)
,if(_i=-1)
,,LB_SelectItem(lParam 0)
,,_i=LB_SelectedItem(lParam lb1si)
,str lb2ii 
,itemslb2=sub.gotoitemedit(lb1si)
,SendMessage(hlb2 LB_RESETCONTENT 0 0)
,itemslb2.findreplace(":sub." "     ")
,itemslb2.findreplace(";;" "     ")
,itemslb2.findreplace(":" "     ")
,foreach lb2ii itemslb2
,,LB_Add(hlb2 lb2ii)    
,lb6lc=LB_GetCount(hlb2)
,case LBN_DBLCLK<<16|4
,_i=LB_SelectedItem(lParam _s)
,mac+ _s    
,case LBN_DBLCLK<<16|6
,str lb2t
,_i=LB_SelectedItem(lParam lb2t)
,if(_i=-1)
,,LB_SelectItem(lParam 0)
,,_i=LB_SelectedItem(lParam lb2t)
,int lb6ic=LB_GetCount(lParam)
,if(lb6ic<>lb6lc)
,,ARRAY(str) b=itemslb2
,,for i 0 b.len
,,,if(StrCompare(b[i] lb2t)=0)
,,,,_i=i
,,,,break
,LB_SelectedItem(id(4 hDlg)  _s)
,mac+ _s
,SendMessage(h SCI.SCI_GOTOLINE _i+1 0)
,int ii=findrx(lb2t "Sub." 0 1)
,if ii!=-1
,,int cp=SendMessage(h SCI.SCI_GETCURRENTPOS 0 0)
,,cp+ii
,,SendMessage(h SCI.SCI_GOTOPOS cp 0)
,sub.FlashCodeLine(_i+1 h)
ret 1

#sub gotoitemedit
function~ ~name
str pattern="(?m)^(.+\s\:.+)"
_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

#sub FlashCodeLine
function line hce
if(!hce) hce=GetQmCodeEditor
int indicator=9
SendMessage(hce SCI.SCI_SETINDICATORCURRENT indicator 0)
SendMessage(hce SCI.SCI_INDICSETALPHA indicator 100)
SendMessage(hce SCI.SCI_INDICSETFORE indicator 0x00FF00)
SendMessage(hce SCI.SCI_INDICSETSTYLE indicator SCI.INDIC_STRAIGHTBOX)
SendMessage(hce SCI.SCI_INDICSETUNDER indicator TRUE)
int lsp=SendMessage(hce SCI.SCI_POSITIONFROMLINE line 0)
int lep=SendMessage(hce SCI.SCI_GETLINEENDPOSITION line 0)
rep 4
,SendMessage(hce SCI.SCI_INDICATORFILLRANGE lsp lep-lsp)
,0.25
,SendMessage(hce SCI.SCI_INDICATORCLEARRANGE lsp lep-lsp)
,0.25
SendMessage(hce SCI.SCI_SETINDICATORCURRENT 0 0)

#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_CHAR
,sel wParam
,,case VK_RETURN
,,sel cid
,,,case [3,5]
,,,ret 0
,case WM_KEYDOWN
,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_SELCHANGE<<16|GetDlgCtrlID(id(4 Phwnd)) id(4 Phwnd)
,,,case 5
,,,SendMessage Phwnd WM_COMMAND LBN_DBLCLK<<16|GetDlgCtrlID(id(6 Phwnd)) id(6 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 5
,,,SendMessage id(6 Phwnd) message wParam lParam            
,,ret

int wndproc=GetProp(hWnd "wndproc"); if(!wndproc) ret
ret CallWindowProcW(wndproc hWnd message wParam lParam)
#sub DisableEnableAutoText 
function mode [str&atItems]
QMITEM q; int i
ARRAY(str) atn
rep
,i=qmitem(-i 1|16 &q 1)
,if(i=0) break
,if q.itype=4
,,atn[]=q.name
,,sel mode
,,,case 1
,,,dis+ q.name
,,,case else
,,,dis- q.name
if mode <>1
,ret
atItems=atn
Is the following function possible?  Huh   This is what I always wanted to achieve. Big Grin

1.Type keywords to filter all AutoText items

2.Enter to run, double click to edit


Attached Files Image(s)
   
dont think so
Many AutoText software have this filtering feature.

This way, the interface is much simpler
Maybe they do but i dont think qm autotext is programmed that way. Think it's just user-typed text triggered only
Well, I agree with your thoughts. The above method of disabling all the autotext is a bit situation.

I have disabled some items before, After using the code, it all enabled. Wink

If the comment text is long, it cannot be displayed in the list box. Please see the picture below

I have an idea.

When the mouse hovers over the item, a prompt will display, the content  is the text of the comment.


Attached Files Image(s)
   
2 possibilities
1.  would need to measure text length and set horizontal scrollbar width. listbox does not automatically adjust horizontal scrollbar has to be programmed. 
2. change list box to SysListView32 but would require more programming.
as far as your other issue i guess i could make a list of items that are already disabled and when the Enable part of the function runs check that list and skip those items.
I need to search for disabled items, but they remain disabled after the search.


Forum Jump:


Users browsing this thread: 6 Guest(s)