08-07-2006, 10:54 AM
It seems that it works.
;/
function hcb
;Automatically completes when you type in combo box.
;Call from dialog procedure, on CBN_EDITCHANGE.
;hcb - combo box handle (use lParam).
;Allow to delete text from the end.
;EXAMPLE
,;case CBN_EDITCHANGE<<16|3
,;CB_AutoComplete lParam
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)
ifk(B)
,,str a.getwintext(hcb)
,,int s1 s2
,,SendMessage(hcb CB_GETEDITSEL &s1 &s2)
,,_i=s2-s1
,,_s.left(a a.len-_i)
,,_s.setwintext(hcb)
,,'E