Solved

How do I create a UserInterface thread in Delphi?

Posted on 1999-01-06
4
265 Views
Last Modified: 2010-04-04
Is it possible to make one using TThread object ?

I tried to create a form in Execute function of Thread but it doesn't return from the constructor. Please help me out...
0
Comment
Question by:rjagan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
bcrotaz earned 30 total points
ID: 1354838
I think you'll find you can't.
The VCL is not thread-safe.  Therefore you can't create a form in a thread, because it would call methods on the Application variable, which would be accessed from other threads too.

The best way out of this is to leave your user interface in the main VCL thread, and do all your intensive processing in other threads.  Then to display results from a thread, use the TThread.Synchronize(MyMethod) method.  There's some good help on this method.

Bryan
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1354839
Bryan is right. I really HATE it that the VCL is not thread safe...  :-(
0
 

Author Comment

by:rjagan
ID: 1354840
Thanks a lot for ur consideration
0
 

Author Comment

by:rjagan
ID: 1354841
Thanks a lot for ur consideration
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question