Solved

How do I create a UserInterface thread in Delphi?

Posted on 1999-01-06
4
260 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
  • 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi inherited method 6 78
When i run adoquery my application freezes 26 187
How to convert memory stream to PDF file 6 169
firemonkey keyboard covers the controls 1 49
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

680 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