Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do I create a UserInterface thread in Delphi?

Posted on 1999-01-06
4
Medium Priority
?
271 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 90 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

Independent Software Vendors: 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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

705 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