04-20-2019, 02:22 AM
(This post was last modified: 04-20-2019, 02:40 AM by win.
Edit Reason: Problem
)
I added a filter search function to the edit box in the combo box (This is very useful when there are a lot of items in the list), see the GIF below.
But The only problem now is that
the filtered results cannot be displayed in real time in the list of combo boxes.
I searched a lot in the forum, but I didn't find the answer. Is this impossible?
Macro Code+filter
possible yes but i forsee a problem when autotext is only single line.
When a single line of text, the front number shows 0
There is a problem now
When I press the esc key, the dialog will close.
I want to implement:
A. when I press the esc key,
empty the contents of the edit box in the upper left corner, and the cursor is positioned in the edit box.
B. When I press the esc key twice,
close the window.
How to achieve?
But The only problem now is that
the filtered results cannot be displayed in real time in the list of combo boxes.
I searched a lot in the forum, but I didn't find the answer. Is this impossible?
Macro Code+filter
[size=large]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
ARRAY(str) aList=atn
IQmDropdown ddl
int inERS
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 334 188 "Edit Existing AutoText"
;3 ComboBox 0x54230641 0x0 11 8 120 173 ""
;4 ComboBox 0x54230641 0x0 145 8 174 172 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2040802 "*" "" "" ""
str controls = "3 4"
str cb3 cb4
cb3=_s
if(!ShowDialog(dd &sub.DlgProc &controls)) ret
#sub DlgProc
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,CB_SelectString(id(3 hDlg) "test")
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
int hcb2=id(4 hDlg) ;;combo box
sel wParam
,case IDOK
,case IDCANCEL
,case 10 ;;Add
,DT_Ok hDlg
,case CBN_SELENDOK<<16|3
,str cb1si
,_i=CB_SelectedItem(lParam cb1si)
,str cb2ii itemscb2=sub.gotoitemedit(cb1si)
,SendMessage(hcb2 CB_RESETCONTENT 0 0)
,itemscb2.findreplace(":sub." " ")
,itemscb2.findreplace(";;" " ")
,foreach cb2ii itemscb2
,,CB_Add(hcb2 cb2ii)
,case CBN_DBLCLK<<16|4
,str cb2t
,_i=CB_SelectedItem(lParam cb2t)
,_s.getwintext(id(3 hDlg))
,mac+ _s
,int c=GetQmCodeEditor
,SendMessage(c SCI.SCI_GOTOLINE _i+1 0)
,int ii=findrx(cb2t "Sub." 0 1)
,int cp=SendMessage(c SCI.SCI_GETCURRENTPOS 0 0)
,cp+ii
,SendMessage(c SCI.SCI_GOTOPOS cp 0)
,
,case CBN_EDITCHANGE<<16|3 sub.OnTextChanged lParam
,
ret 1
#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
#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[/size]
possible yes but i forsee a problem when autotext is only single line.
When a single line of text, the front number shows 0
There is a problem now
When I press the esc key, the dialog will close.
I want to implement:
A. when I press the esc key,
empty the contents of the edit box in the upper left corner, and the cursor is positioned in the edit box.
B. When I press the esc key twice,
close the window.
How to achieve?