sShowMessage with not skin in Thread

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #32770
    Rafał Drzewiecki
    Participant

    type

    TForm1 = class(TForm)

    sSkinManager: TsSkinManager;

    sSkinProvider: TsSkinProvider;

    private

    public

    end;

    type TUpdate = class(TThread)

    protected

    procedure Execute; override;

    end;

    procedure TUpdate.Execute;

    begin

    FreeOnTerminate := True;

    sMessageDlg('Test','Test', mtInformation, [mbOk], 1);

    end;

    procedure TForm1.Button;

    var

    Test : TUpdate;

    begin

    Test := TUpdate.Create;

    Test.Resume;

    end;

    Why have not skin in the thread?

    #38392
    Support
    Keymaster

    Hello! You should use synchronization :

    Code:
    type

    TUpdate = class(TThread)
    protected
    procedure Execute; override;
    procedure ShowDlg;
    end;

    procedure TUpdate.Execute;
    begin
    FreeOnTerminate := True;
    Synchronize(ShowDlg);
    end;

    procedure TForm1.sButton1Click(Sender: TObject);
    var
    Test : TUpdate;
    begin
    Test := TUpdate.Create(True);
    Test.Resume;
    end;

    procedure TUpdate.ShowDlg;
    begin
    sMessageDlg('Test','Test', mtInformation, [mbOk], 1);
    end;

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.