Topic: Slow Combobox Filter Problem
Hi,
i am using myvisualdatabase version v1.52
on my project i am using comcobox.
when type in combo box it filters by name
i am using this function to filter from db
procedure Form1_ComboBox1_OnKeyPress (Sender: string; var Key: Char);
var
id: integer;
begin
if ord(Key)= 13 then
begin
id := Form1.ComboBox1.dbItemID;
Form1.ComboBox1.DroppedDown:=False;
Form1.ComboBox1.dbItemID := id;
Key := #0;
Exit;
end;
if ((ord(Key)= 8) OR (ord(Key)= VK_ESCAPE )) then // for backspace button
begin
s_cbGroups := '';
Form1.ComboBox1.Text := '';
UpdateDatabase('kim');
Key := #0;
Form1.ComboBox1.DroppedDown:=False;
Form1.ComboBox1.dbItemID := -1;
Exit;
end;
s_cbGroups := s_cbGroups + Key;
Key := #0;
Form1.ComboBox1.dbFilter := '(isim LIKE ''%'+ s_cbGroups +'%'''+')';
id := Form1.ComboBox2.dbItemID;
UpdateDatabase('kim');
Form1.ComboBox2.dbItemID := id;
Form1.ComboBox1.DroppedDown:=True;
Form1.ComboBox1.Text := s_cbGroups;
Form1.ComboBox1.SelStart := Length(s_cbGroups);
end;
procedure Form1_ComboBox1_OnCloseUp (Sender: string);
var
id,id2: integer;
begin
id := Form1.ComboBox1.dbItemID;
id2 := Form1.ComboBox2.dbItemID;
Form1.ComboBox1.dbFilter := '';
UpdateDatabase('kim');
Form1.ComboBox1.dbItemID := id;
Form1.ComboBox2.dbItemID := id2;
s_cbGroups := '';
end;
For example when i try to find name "John"
i type jo
and normally it was finding john instantly.
But now the name number increased to 600 customer so it become slow
how can i make it fast?
Thanx