Making controls refresh in Delphi

Posted on 2006-03-27
Medium Priority
Last Modified: 2008-01-09
I have an application that I am running in the IDE. It has some TDBGrid controls which scroll as my program works through various database tables. I placed some other controls on the form to indicate progress but these don't update till the program has finsihed. I cannot figure out why! Any suggestions?
Question by:riskassessor
LVL 17

Accepted Solution

mokule earned 120 total points
ID: 16301349
use Refresh method of a control You want to refresh immediately after operation.
Otherwise it refreshes in some idle time.

Assisted Solution

mwbowman earned 80 total points
ID: 16301498
Use Application.ProcessMessages within your code where you would like the updates to occur.

Expert Comment

ID: 16306603
I'm not sure if this is what is needed in this case, but sometimes I have found that calling the Repaint method is the best way to get a control to immediately redisplay itself. Repaint is a public virtual method of TControl.

Author Comment

ID: 16307491
Thanks to everyone for solutions.

Refresh (of either the form or control) works. Just put it in the code where you want the control/form to update.

Application.ProcessMessages also works. (You need to include Forms in Uses)

Repaint works interchangeably with Refresh (seem to be different names for same command).

Thanks again.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month15 days, 18 hours left to enroll

850 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