Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
press enter select the entry in the combobox
#1
hello everyone,

Use the following code, Type characters in the edit box, it will be completed automatically

For example, when I type the letter a, the abc entry is automatically completed

I expect that:
1.If I press enter, the abc entry will be selected

What code do I need to add? Any suggestions are welcome. Thanks in advance

in addition
2.How to make editbox and combobox display the same content at the same time?
For example, when I type ab in the e4 editbox, the combobox cb3 displays ab at the same time



Macro Macro3
Code:
Copy      Help
_s=
;abc
;ba
;cp
;es
;fw
;hw

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

str controls = "3 4"
str cb3 e4
cb3=_s
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.CB_AutoComplete lParam
ret 1

#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)
#2
2. has been implemented, but not completed automatically

[Image: b.gif]

Macro Macro3
Code:
Copy      Help
_s=
;abc
;ba
;cp
;es
;fw
;hw

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

str controls = "3 4 5"
str cb3 e4 e5
cb3=_s
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
,case WM_TIMER
,sel wParam
,,case 1
,,KillTimer hDlg wParam
,,str e3sf.getwintext(id(4 hDlg))
,,e3sf.setwintext(id(5 hDlg))
,,e3sf.setwintext(id(3 hDlg))
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case EN_CHANGE<<16|4
,SetTimer hDlg 1 100 0
,case CBN_EDITCHANGE<<16|3
,sub.CB_AutoComplete lParam
ret 1

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


Forum Jump:


Users browsing this thread: 1 Guest(s)