 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Maarten Guest
|
Posted: Thu Jan 20, 2005 8:49 am Post subject: Repaint |
|
|
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
|
Posted: Thu Jan 20, 2005 9:01 am Post subject: Re: Repaint |
|
|
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
|
Posted: Thu Jan 20, 2005 9:46 am Post subject: Re: Repaint |
|
|
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 |
|
 |
|
|
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
|
|