I have two new ideas.
1. Convert the read-only combo box into an editable combo box and support auto-completion. There is related code below, but I don't know how to use it.
2. If I enter a name that does not exist in the combo box, first create an AutoText file (Its name is the name entered in the previous step.) and insert the phrase into the new file.
Function dlg_combo_autocomplete
Function CB_AutoComplete
1. Convert the read-only combo box into an editable combo box and support auto-completion. There is related code below, but I don't know how to use it.
2. If I enter a name that does not exist in the combo box, first create an AutoText file (Its name is the name entered in the previous step.) and insert the phrase into the new file.
Function dlg_combo_autocomplete
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "3"
str cb3
cb3="&one[]two[]three[]four[]five[]six[]seven[]eight[]nine"
if(!ShowDialog("dlg_combo_autocomplete" &dlg_combo_autocomplete &controls)) ret
;BEGIN DIALOG
;0 "" 0x90C80A48 0x100 0 0 220 132 "Form"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 ComboBox 0x54230342 0x0 6 4 96 213 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2010900 "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case CBN_EDITCHANGE<<16|3
,CB_AutoComplete lParam
,case IDOK
,case IDCANCEL
ret 1
Function CB_AutoComplete
/
function hcb
;Automatically completes when you type in combo box.
;Call from dialog procedure, on CBN_EDITCHANGE.
;hcb - combo box handle (use lParam).
;EXAMPLE
,;case CBN_EDITCHANGE<<16|3
,;CB_AutoComplete lParam
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)