Making controls refresh in Delphi

Posted on 2006-03-27
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

    use Refresh method of a control You want to refresh immediately after operation.
    Otherwise it refreshes in some idle time.
    LVL 1

    Assisted Solution

    Use Application.ProcessMessages within your code where you would like the updates to occur.
    LVL 1

    Expert Comment

    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

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
    Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now