Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Edit box displays a list of identical letters
#6
The list box below the combo box, I can directly double-click the item inside, sometimes it is very convenient to operate  Smile

How make search results appear in the list below the combo box?

My ultimate goal is to achieve three-level management of Autotext, as shown below

When I click the folder in the list in the first combo box, the file inside it will appear in the list in the second combo box. When I click on the file name, the items in the file appear in the list of the third combo box, Finally, when I press the OK button, It will automatically jump to the item(subfunction) of the file Smile

Macro AutoText Management
Code:
Copy      Help
QMITEM q; int i
ARRAY(str) atn
ARRAY(int) htvi
str sList
rep
,i=qmitem(-i 1|16 &q 1|2|4|8)
,if(i=0) break
,if q.itype=4
,,atn[]=q.name
,,htvi[]=q.htvi
sList=atn

ARRAY(str) aList=sList
IQmDropdown ddl
int inERS

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 338 182 "AutoText Management" "4"
;6 Static 0x54000000 0x0 37 4 48 13 "Folder"
;7 Static 0x54000000 0x0 148 4 48 13 "File"
;8 Static 0x54000000 0x0 259 4 48 13 "item"
;9 ComboBox 0x54230641 0x0 7 17 104 138 ""
;3 ComboBox 0x54230641 0x0 117 17 104 138 ""
;4 ComboBox 0x54230641 0x0 227 17 104 138 ""
;1 Button 0x54030001 0x4 213 162 48 14 "OK"
;2 Button 0x54030000 0x4 272 162 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040801 "*" "" "" ""

str controls = "9 3 4"
str cb9 cb3 cb4
cb3=sList
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
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 CBN_EDITCHANGE<<16|3 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

It’s a bit strange, I can filter if I don’t set any events, please see the image below. Huh

It is very convenient to use the combo box with filtering function to achieve the above goals, but the programming difficulty is also the biggest.  Wink


Attached Files Image(s)
       


Messages In This Thread
RE: Edit box displays a list of identical letters - by win - 04-14-2019, 03:00 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)