Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Some questions about drop-down lists with filter function
#9
@Kevin
about #5 code (I made some changes):

I don't need to sort. I deleted the following line of code, but it doesn't work
 
Code:
Copy      Help
x.Sort(3)
demo:
[Image: a.gif]
I expect the result:
Type a:
c   1a
b   2a
a   3a
-------------
Type b:
c   1b
b   2b
a   3b    


Macro M8
Code:
Copy      Help
str _ts=
;a01c   1a
;a02b   2a
;a03a   3a
;b01c   1b
;b02b   2b
;b03a   3b    

IQmDropdown ddl; int inERS; 

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x8 0 0 158 13 "ABC" "4"
;3 Edit 0x54030080 0x200 0 0 158 13 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "*" "" "" ""

str controls = "3"
str e3

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


#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
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 "")

ARRAY(str) a=_ts

if s="a"
,for _i 0 a.len
,,if(findrx(a[_i] "^a\d{2}(\S+\s+.+)" 0 0 _s 1)<0) continue
,,x.AddRow1(-1 _s)

if s="b"
,for _i 0 a.len
,,if(findrx(a[_i] "^b\d{2}(\S+\s+.+)" 0 0 _s 1)<0) continue
,,x.AddRow1(-1 _s)

if(!x.RowCount) ret
;x.Sort(3)

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

inERS=1
EditReplaceSel hEdit 0 s 1|2|4
inERS=0


Messages In This Thread
RE: Some questions about drop-down lists with filter function - by Davider - 03-21-2023, 11:46 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)