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

x
?
Solved

New form thread

Posted on 2007-11-20
6
Medium Priority
?
228 Views
Last Modified: 2010-04-05
I have small problem (delphi7) how to make thread in new form, now I have app with many forms but if in some form I start some job then freeze all app forms, how to make like one form are in threed and if there going some job
example:

for a:= 0 to 1000 do
  begin
    sleep 10000
  end;


  I can this form minimize and work with main form!!!!
0
Comment
Question by:KarlisB
[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
  • 3
  • 3
6 Comments
 
LVL 19

Expert Comment

by:MerijnB
ID: 20319324
it's probably easier to call
Application.ProcessMessages in each itteration:
for a:= 0 to 1000 do
  begin
    sleep(1000);
    Application.ProcessMessages();
  end;

Open in new window

0
 
LVL 3

Author Comment

by:KarlisB
ID: 20319536
I try in my app like this but that did not work well, there I have 300 lines code with many loops and sql querys, there updating data from one db to many other db, sometimes some query take 10 sec. (not a local DB) and there anyway app freezes !!!!  
0
 
LVL 19

Accepted Solution

by:
MerijnB earned 1500 total points
ID: 20319565
you can make a thread in your form, but it requires some knowledge on async programming etc.
You can not just let a certain form be run from another thread nor can you do screen updates (or changes to any vcl for that matter) from another thread.

Take a look at TThread, this is a quite convenient way to make a process in a separate thread in delphi.

See also here for more info: http://delphi.about.com/od/kbthread/Threading_in_Delphi.htm
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 3

Author Comment

by:KarlisB
ID: 20325896
huhhhh it looks too complicated for me :( I`m beginner in delphi, is not any possibility to make new thread when creating new form and then any job what is going in this form are work separately???
0
 
LVL 19

Expert Comment

by:MerijnB
ID: 20325934
no, unfortunately, working with threads just _is_ complicated, it does not matter what language you are programming in.

The DB you are using can probably also handle it's query's in an async way but I'm not that familiar with that, maybe someone else can say something about that?

We could type out a thread for you, but you will probably get in trouble as soon as you need to make some changes or there is a problem and don't understand the principle.
0
 
LVL 3

Author Comment

by:KarlisB
ID: 20349248
I install the component EZThread works wery wery good, he is wery simple, and easy to use, but MerijnB thanks anyway for information!!!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
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…
Suggested Courses

715 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