I've made some test,
the error occur typing also only 1 char (B, C, D, E....).
Strange thing: if you type 'A' the error does not happen.
When you type the first letter, the lookup works as expected (it shows the first item that starts with that letter).
Code to initialize the component (component name: txtCliente)
with txtCliente do
begin
Columns.Clear;
LookupColumn:= 2;
with Columns.Add do
begin
ColumnType:= ctText;
AutoSize:= False;
Header:= 'ID';
Width:= 0;
end; {with}
with Columns.Add do
begin
ColumnType:= ctText;
AutoSize:= False;
Header:= 'Codice';
Width:= 50;
end; {with}
with Columns.Add do
begin
ColumnType:= ctText;
AutoSize:= False;
Header:= 'Cognome e nome';
Width:= 200;
end; {with}
with Columns.Add do
begin
ColumnType:= ctText;
AutoSize:= False;
Header:= 'Nato il';
Width:= 90;
end; {with}
DropDownWidth:= 340;
ColumnSizing:= False;
DropDownAutoWidth:= False;
end; {with}
Code to fill the items from db:
var
tmpItem: TDropDownItem;
idx: Integer;
currCursor: TCursor;
idsClientiList: TIBDataSet;
begin
idx:= - 1;
currCursor:= Screen.Cursor;
Screen.Cursor:= crHourGlass;
try
txtCliente.BeginUpdate;
txtCliente.Items.Clear;
idsClientiList:= TIBDataSet.Create(Self);
try
idsClientiList.Database:= TMain(Self.Owner).IBDatabase;
idsClientiList.SelectSQL.Text:= 'SELECT ' +
'* ' +
'FROM UTENTI ' +
'WHERE NOT COGNOME LIKE ' + AnsiQuotedStr(prfClientiExclude + '%', '''') + ' ' +
'ORDER BY UPPER(COGNOME), UPPER(NOME)';
idsClientiList.Open;
if not ((idsClientiList.Bof = True) and (idsClientiList.Eof = True)) then
begin
repeat
with idsClientiList do
begin
tmpItem:= txtCliente.Items.Add;
tmpItem.Text.Add(IntToStr(FieldByName('IDUTENTE').AsInteger));
tmpItem.Text.Add(FieldByName('CODICE').AsString);
tmpItem.Text.Add(FieldByName('COGNOME').AsString + ' ' + FieldByName('NOME').AsString);
tmpItem.Text.Add(DateToStr(FieldByName('DATA_NASCITA').AsDateTime));
if (ASelectID > 0) and (FieldByName('IDUTENTE').AsInteger = ASelectID) then
begin
idx:= txtCliente.Items.Count - 1;
end; {if}
end; {with}
idsClientiList.Next;
until (idsClientiList.Eof = True);
end; {if}
idsClientiList.Close;
finally
idsClientiList.Free;
end; {finally}
txtCliente.EndUpdate;
txtCliente.ItemIndex:= - 1;
txtCliente.Clear;
if (ASelectID > 0) and (idx >= 0) then
begin
txtCliente.ItemIndex:= idx;
end; {if}
finally
Screen.Cursor:= currCursor;
end; {finally}