Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 229
  • Last Modified:

New form thread

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
KarlisB
Asked:
KarlisB
  • 3
  • 3
1 Solution
 
MerijnBSr. Software EngineerCommented:
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
 
KarlisBAuthor Commented:
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
 
MerijnBSr. Software EngineerCommented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
KarlisBAuthor Commented:
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
 
MerijnBSr. Software EngineerCommented:
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
 
KarlisBAuthor Commented:
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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now