Hi Peter,

I think this is a case where you want the text processing to go on in a 
separate thread, if you want other functions of your program to run at the 
same time.  If you go this way, don't process the text of the richedit 
directly - you can't  do things with a visual control in a thread, unless 
you do it through the synchronize() call.  So copy the text you want to 
process into a string or a stream, then pass that to the thread as you 
create it.  When the thread is done, copy the processed text back into the 
richedit.

If you don't want to use a thread for some reason, the poor man's way is to 
call Application.ProcessMessages from time to time during your processing, 
but this can cause trouble, for instance if the user tries to close the 
form while it is processing.  You have to disable controls on the form 
during the processing, and prevent the form closing by implementing the 
OnCloseQuery event:

if Screen.Cursor = crHourglass then
   CanClose := False;

This is using screen.cursor to signal that the form is busy:

screen.cursor := crHourglass
try
   // do your processing here
finally
   screen.cursor := crDefault
end;

Unless you want the user to watch the text processing as it happens, in 
this strategy don't process the control's text directly either.  This 
approach probably will only work if nothing else is happening in your 
application.

HTH

Walter


At 02:18 PM 5/7/2006, you wrote:
>Hi guys!
>
>I use RichEdit in my Application. Some of the text operation what I provide
>on the text takes longer time.
>During those operations I cannot move the window, when I start something
>only the RichEdit window is
>refreshing, so the applications other parts are very ugly. Similarly, I run
>this RichEdit application from my other
>program. After starting the named operations on the called RichEdit
>application and I go back to the first program
>the RichEdit freezes and I have to kill it. After it I receive windows
>application error from the system (W'XP).
>
>How can I handle this things (refreshing the whole application during
>RichEdit operation, and running the caller
>program during running the called program's RichEdit application)?
>
>Thanks,
>
>Peter
>
>
>_______________________________________________
>Delphi mailing list -> [email protected]
>http://www.elists.org/mailman/listinfo/delphi

/*
C. Walter Ogston
[EMAIL PROTECTED]
*/


_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to