BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Repaint

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics)
View previous topic :: View next topic  
Author Message
Maarten
Guest





PostPosted: Thu Jan 20, 2005 8:49 am    Post subject: Repaint Reply with quote




When I'm doing extensive calculations or I/O (for instance, reading a large file), the form never repaints.

Practical example: I wrote a program that helps me out with Scrabble. The word list is quite extensive, so it takes quite some time to read from disk. When I drag another Window over my Borland application, the form is not updated and I get an empty rectangle on my screen. When Borland is finished processing, the repaint is carried out.

How do I solve this? Do I have to enter code in every loop that requires a lot of calculation?

-Maarten
Back to top
Wiljo de Ruiter
Guest





PostPosted: Thu Jan 20, 2005 9:01 am    Post subject: Re: Repaint Reply with quote



Maarten wrote:
Quote:
When I'm doing extensive calculations or I/O (for instance, reading a large file), the form never repaints.

Practical example: I wrote a program that helps me out with Scrabble. The word list is quite extensive, so it takes quite some time to read from disk. When I drag another Window over my Borland application, the form is not updated and I get an empty rectangle on my screen. When Borland is finished processing, the repaint is carried out.

How do I solve this? Do I have to enter code in every loop that requires a lot of calculation?

-Maarten
Hello Maarten,


Do you read this word list more than once, everytime you need to test a word in
the Scrabble game? Maybe it's better to read it once at the start of your
program. If this doesn't help, try starting a thread that reads the file. This
should free your form from not being updated. Take a look at TThread in your
online help.

Success,
Wiljo.

Back to top
Hans Galema
Guest





PostPosted: Thu Jan 20, 2005 9:46 am    Post subject: Re: Repaint Reply with quote



Wiljo de Ruiter wrote:

Quote:
try starting a thread that
reads the file. This should free your form from not being updated. Take
a look at TThread in your online help.

That is a good solution.

A simple solution would be to add a statement

Application->ProcessMessages();

in the loop.

If it is a fast loop then there were to many calls
and your application would slow down. In that case
use a counter to call the function say every 100 loops.

Hans.

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.