Unit 'msethreadcomp' Package
[Overview][Types][Classes][Index] [#msegui]

tthreadcomp

[Properties (by Name)] [Methods (by Name)]

Runs onexecute in a separate thread, so the main event loop (and the user interface) stays responsive during a long operation

Declaration

Source position: msethreadcomp.pas line 38

type tthreadcomp = class(tactcomponent)

public

  constructor create(); override;

  destructor destroy; override;

  property datapo: pointer; [r]

  procedure run();

  procedure terminate;

  procedure waitfor;

  function lock;

  procedure unlock;

  procedure postevent();

  function waitevent();

  property thread: teventthread; [r]

  property terminated: Boolean; [r]

published

  property options: threadcompoptionsty; [rw]

  property stacksizekb: Integer; [rw]

  property active: Boolean; [rw]

  property onstart: threadcompeventty; [rw]

  property onexecute: threadcompeventty; [rw]

  property onterminate: threadcompeventty; [rw]

  property onterminated: threadcompeventty; [rw]

end;

Inheritance

tthreadcomp

  

Runs onexecute in a separate thread, so the main event loop (and the user interface) stays responsive during a long operation

|

tactcomponent

|

tmsecomponent,iactivatorclient

  

Extends the FPC tcomponent with object linking facilities and the like; base of every MSEgui component

|

tcomponent,ievent,iificommand,iificlient

|

tpersistent

|

TObject

Description

Runs onexecute in a separate thread, so the main event loop (and the user interface) stays responsive during a long operation. onexecute must poll sender.terminated itself and return when it becomes True, e.g. while not sender.terminated do begin ... end; — terminate only requests termination, it does not stop the thread by itself. To access widgets or other main-thread data from onexecute, wrap the access in application.lock/ application.unlock. To close a form once its worker thread is done, call release (not free) on the form from onterminate. Killing a thread outright (via the underlying thread.kill) can lose resources and should only be used as a last resort.


Documentation generated on: 2026-10-03