Menu

#1 ComboBox Text addings

open
nobody
4
2005-12-31
2005-12-31
Max Kleiner
No

A useful and common trick for comboboxes is to add a
new element to the list when a user enters some text
and presses the enter key:

procedure T_DWSForm.cBox1KeyPress(sender: TObject;
var key: Char);
begin
if key = chr(13) then
with sender as TComboBox do
if(text <> '') and (items.IndexOf(text) < 0) then
items.Add(text);
end;

Discussion

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.