Jump to content

Call event from TThread


Jean-Marc Kiener

Recommended Posts

Hello,
I have following small TThread class:
 

  TOnProgress = procedure( Sender: TObject; Value: integer; Msg: string ) of object;

  TWorker = class(TThread)
  private
    { Private-Deklarationen }
    FMin: integer;
    FMax: integer;
    FOnProgress: TOnProgress;
    FProgressMsg: string;
    FPosition: integer;
    procedure DoOnProgress( aValue: integer; aMsg: string );
  protected
    procedure Execute; override;
  public
    constructor Create( aOnProgress: TOnProgress ); reintroduce;
    property OnProgress: TOnProgress read FOnProgress write FOnProgress;
    property ProgressMsg: string read FProgressMsg;
    property Position: integer read FPosition;
  end;

When i create the TWorker Object in a unigui form with a aOnProgress procedure parameter it does not work properly ( per example  FWorker1 := TWorker.Create( UpdateGUI1 ); ). The TOnProgress method "UpdateGUI1" of the unigui form is called, but mostly it does nothing. I assume that i have to find the "right" unigui form instance from where the thread was called? 

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...