Answer the question
In order to leave comments, you need to log in
Damn, I can’t figure out why the program slows down during the cycle ...?
procedure TForm1.ListBox1ItemClick(const Sender: TCustomListBox;
const Item: TListBoxItem);
var
s1, s2, c, v, s, d: string;
i: integer;
basa: TStringList;
begin
AniIndicator1.Enabled := true;
AniIndicator1.Visible := true;
Application.ProcessMessages;
Sleep(100);
basa := TStringList.Create;
basa.Text := Memo1.Lines.Text;
ListBox2.Clear;
s2 := ListBox1.Items[ListBox1.ItemIndex];
if length(s2) = 1 then
s1 := s2
else
begin
s1 := copy(s2, 1, 2);
/// ----------------------
for i := 0 to basa.Count - 1 do
begin
c := basa.Strings[i];
if length(c) = 1 then
v := c
else
begin
v := copy(c, 1, 2);
if v = s1 then
ListBox2.Items.Add(basa.Strings[i]);
end;
Application.ProcessMessages;
Sleep(100);
end;
Application.ProcessMessages;
Sleep(100);
- this is necessary for displaying aniindicator'a in the application and with the addition of pplication.ProcessMessages; slows down even worse than without it, because even without it, processing the database even in 60 lines already takes time. On the PC everything flies, on the phone it slows down. Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question