Solved

Procedures

Posted on 1997-10-31
5
199 Views
Last Modified: 2010-04-04
I have a Procedure that calls two other procedures

eg

Procedure TForm.Button1Click(Sender:TObject);
begin
  GetOutputFile(CurrentFile);
  DrawCoords(Sender);
end;

The problem is that the procedure DrawCoords executes BEFORE the procedure GetOutPutFile is finished. Where I want it to execute after GetOutPutFile is finished. DrawCoords ends up reading blank information from a StringGrid because GetOutPutFile hasnt finished reading the file and writing it to the StringGrid. So basically I want DrawCoord to wait momenterily
0
Comment
Question by:Ham
5 Comments
 
LVL 3

Expert Comment

by:mirek071497
ID: 1349228
You are on wrong way.
GetOutputFile(CurrentFile) must finished to execute DrawCoords(Sender).
You must place here some code from GetOutputFile(CurrentFile).
I think so your error is there.
0
 
LVL 3

Expert Comment

by:mirek071497
ID: 1349229
What do you say ????
0
 

Author Comment

by:Ham
ID: 1349230
Hi

There is something wrong here.  A Delphi procedure cannot execute until the one before it has finished.  An exception would be if GetOutputFile starts a thread.  In that case, GetOutputFile could finish, and DrawCoords could start before the thread has started/initialized.

As Mirek asked, please could you give us the code from GetOutputFile.

JB
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1349231
GetOutputFile starts something asynchroniusly (a thread of some kind; maybe calls an async method of a component). You should put DrawCoords in the EVENT generated when the thread (or async method) completes.
0
 
LVL 2

Accepted Solution

by:
alona041797 earned 50 total points
ID: 1349232
Please send us the code of GetOutputFile.

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now