TioGuedes
TioGuedes

Reputation: 43

Show a message dialog form outside the main UI thread

I want to create a dialog utility unity that could be called in an asynchronous way from different threads and show my dialog message on the active form, and I was sure that TDialogServiceAsync was the perfect way to do it but I can't call the MessageDialog method from outside the Main UI Thread.

Is it possible to achieve what I want without having to actually create a method in my main form that shows the dialog?

I'm developing for Windows right now but a method that could work on multiple plataforms would be appreciated.

Thanks in advance.

Upvotes: 2

Views: 1150

Answers (1)

zeus
zeus

Reputation: 13345

no, everything that touch the ui must be done in the main ui thread (quite logic). the only think you can do in your background thread

TThread.queue(nil,
  procedure
  begin
    showdialog...
  end);

Upvotes: 2

Related Questions