Psylord
asked on
Execute procedure, wait until finished, resume.
I have a procedure that loads settings for colors...
I call the procedure, then I use RichEdit1.Selattributes.Co lor like so:
MyProcedure; {Gets MyInt - Color for text}
RichEdit1.Selattributes.Co lor := MyInt;
RichEdit1.Lines.Add('MyTex t');
The problem is, the "MyProcedure" isn't done before the app moves to the next line!
I've tried:
MyProcedure; {Gets MyInt - Color for text}
Application.ProcessMessage s;
RichEdit1.Selattributes.Co lor := MyInt;
RichEdit1.Lines.Add('MyTex t');
But that doesn't help!
How can I call the procedure, WAIT until it's finished, then call the rest without writing an entire new procedure?
-Psylord
I call the procedure, then I use RichEdit1.Selattributes.Co
MyProcedure; {Gets MyInt - Color for text}
RichEdit1.Selattributes.Co
RichEdit1.Lines.Add('MyTex
The problem is, the "MyProcedure" isn't done before the app moves to the next line!
I've tried:
MyProcedure; {Gets MyInt - Color for text}
Application.ProcessMessage
RichEdit1.Selattributes.Co
RichEdit1.Lines.Add('MyTex
But that doesn't help!
How can I call the procedure, WAIT until it's finished, then call the rest without writing an entire new procedure?
-Psylord
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
And don't forget to destroy the event object in the end:
TermEvent.Free;
TermEvent.Free;
I don't agree with you. It must do 'MyProcedure' 1st, and then do the rest. Try debugging and look how it moves. It can only do so if 'MyProcedure' is a thread.
But where's the return value of it? Shouldn't it the 1st line say:
MyInt := MyProcedure;
and then use the value in the next line.
But where's the return value of it? Shouldn't it the 1st line say:
MyInt := MyProcedure;
and then use the value in the next line.
ASKER
I think the problem is that I had it in the create event (when the form might not even have a handle yet!)..
But this code looks useful.... Thanks!