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
#71
Very beautiful, fully achieved the goal   Tongue

@kevin

Can you add an editing function?

Sometimes, I need to modify an item in an AutoText. After clicking the Edit button (This button is gray when no item is selected), a list of the selected AutoText items will pop up. When I click on the list name, I will jump to the subfunction of the item.

I found a filtering problem, please see the picture

Macro Macro2
Code:
Copy      Help
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 sList
sList=atn
;sList=
;;one
;;two
;;three
;;four

ARRAY(str) aList=sList
IQmDropdown ddl
int inERS

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 Edit 0x54030080 0x200 8 8 96 12 ""
;4 ComboBox 0x54230641 0x0 113 8 102 99 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040801 "*" "" "" ""

str controls = "3 4"
str e3 cb4
cb4=sList

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

out
out e3
out cb4


#sub DlgProc v
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
,case EN_CHANGE<<16|3 sub.OnTextChanged lParam
,case CBN_EDITCHANGE<<16|4 sub.OnTextChanged lParam

ret 1


#sub OnTextChanged v
function hEdit

if(inERS) ret
if(ddl) ddl.Close; ddl=0

str s.getwintext(hEdit)
if(!s.len) ret

ICsv x._create
x.AddRow1(0 "")
int i
for i 0 aList.len
,if(find(aList[i] s 0 1)<0) continue
,x.AddRow1(-1 aList[i])
if(!x.RowCount) ret

if(ShowDropdownList(x i 0 1 hEdit 0 0 0 ddl)&QMDDRET_SELOK=0) ret
s=x.Cell(i+1 0)

inERS=1
EditReplaceSel hEdit 0 s 1
inERS=0


Attached Files Image(s)
       


Messages In This Thread
RE: How to get a list of all AutoText files in the left pane - by win - 04-17-2019, 01:59 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)