R
R
Romanson2016-03-21 15:54:34
Delphi
Romanson, 2016-03-21 15:54:34

AniIndicator1.enabled := true; AniIndicator1.Visible := true; how to work with it?

AniIndicator1.enabled := true;
AniIndicator1.Visible := true; - Why is the cycle done on android first, then only AniIndicator1 is displayed? those. The loading indicator is not visible at all.
Here is a sample code

procedure TForm1.ListBox1ItemClick(const Sender: TCustomListBox;
  const Item: TListBoxItem);
var
  s1, s2, c, v, s, d: string;
  i: integer;
begin
  AniIndicator1.enabled := true;
  AniIndicator1.Visible := true;

  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 Memo1.Lines.Count - 1 do
    begin
      c := Memo1.Lines.Strings[i];
      if length(c) = 1 then
        v := c
      else
      begin
        v := copy(c, 1, 2);
        if v = s1 then
          ListBox2.Items.Add(Memo1.Lines.Strings[i]);

      end;
              AniIndicator1.enabled := false;
        AniIndicator1.Visible := false;
    end;

  end;

end;

end.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Zagaevsky, 2016-03-21
@zagayevskiy

I dare to assume that nothing cardinal could be done with MainThread in Delphi. When you make it visible, a message is queued to tell you to make it visible. The turn comes to this only at the next step of Looper'a. The step will not happen until you have done everything you wanted in the current step. Well, by the time it comes down to it, you're already hiding.
In short, the moral of this fable - do not do anything for a long time in MainThread. Turned on progress - launched an asynchronous task - hid the progress at its end.

X
xmoonlight, 2016-03-21
@xmoonlight

It is necessary to redraw the object at the end of each cycle.
.Repaint or .Redraw or .Update or something like that....

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question