Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Your main thread needs to stay responsive to the message queue while your long process is running. If not, you are blocking the animation (and other aspects of the UI) from receiving new messages, like paint requests and timers notifies. You need to move any long processing to a separate thread instead. Start the thread and then start the animation. Let the main thread handle the UI normally in the meantime. When the thread is finished, have it notify the main thread, which can then stop the animation, and finish any other processing it needs on the result of the thread, if any. For example:</p> <pre><code>type TLoadThread = class(TThread) public Host: string; NamePath: string; Port: Integer; Config: Boolean; constructor Create(const aHost, aNamePath: string; aPort: Integer; aConfig: Boolean); reintroduce; protected procedure Execute; override; end; constructor TLoadThread.Create(const aHost, aNamePath: string; aPort: Integer; aConfig: Boolean); begin inherited Create(True); FreeOnTerminate := True; Host := aHost; NamePath := aNamePath; Port := aPort; Config := aConfig; end; procedure TLoadThread.Execute; begin //do processing Synchronize( procedure //update main form end ); //do processing end; </code></pre> <p></p> <pre><code>var Loading: Boolean = False; zLThread: TLoadThread = nil; procedure TfrmMain.FormActivate(Sender: TObject); begin zLThread := TLoadThread.Create(Host, NamePath, Port, Config); zLThread.OnTerminate := ThreadTerminated; zLThread.Start; Loading := True; AniIndi.Visible := True; AniIndi.Enabled := True; UpdateAll; end; procedure TfrmMain.ThreadTerminated(Sender: TObject); begin zLThread := nil; Loading := False; AniIndi.Enabled := False; AniIndi.Visible := False; UpdateAll; end; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload