Solved

Procedures

Posted on 1997-10-31
5
201 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…

829 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