Process Messages

Posted on 2006-05-19
Last Modified: 2010-04-05

I have 2 forms.
In form 1 there is a timer that sends data to a graph in the second form.
For those values i calculate the Max, min and average values. (Unit1)

There is a big problem with those values when i move the form2.

Application seems paused. No values are drawn in the graph BUT when i stop moving
the form then ALL the values that happened between 10 or more seconds ... are stacked in 1 second..

Example :

 Second     :   |  1  |  |  2  |  |  3  |  |  4  |  |  5  |  |  6  |  |  7  |  |  8  |
 Value       :   | 15  |  | 40 |  |  4  |  | 28 |  | 35 |   | 5  |   | 18 |  | 19 |  ---> Random Values
When i move the form :

 Second     :   |  1  |...| 15 |  | 16 |  | 17 |  | 18 |  | 19 | ... --> Move the form for 15 seconds
 Value       :   | 15  |  | 800 |  |  4  | | 28 |  | 35 |   | 5  | ... --> All that happened between 2-14 are in the 15th sec.

I tried to put Application ProcessMessages in several places but nothing.
This doesnt happen when i move form1.

What should i do?
Thanks in advance.
Question by:CodedK
    LVL 17

    Accepted Solution


    I made a simple experiment with just a label on the second form and the following code in form one's timer event:

    uses unit2;

      count: integer = 0;

    procedure TForm1.Timer1Timer(Sender: TObject);
      if Form2.Visible then begin
        Form2.Label1.Caption := IntToStr(count);
        count := count + 1;

    The result was that the label continued counting while I was moving the form around. So, I suppose your problem might be in that graph component you're using.
    What type is it actually?

    Regards, Geo
    LVL 16

    Author Comment

    Hi Geo. Thanks for your response :)

    Well its strange. Seems like a side effect on slow machines.
    Recently i've replaced my video card with a very old one.
    The problem was fixed when i turned off hardware acceleration.

    I've used Teechart, the one that is embedded in Delphi 7.

    You could reproduce this side effect like this:
    UNIT1 :

    uses Unit2;

    {$R *.dfm}

    procedure TForm1.Timer1Timer(Sender: TObject);
    If Flow>Max then Max:=Flow; // This value will never go above 1000.
    Form2.Label1.Caption:='Current Max : '+IntToStr(Max);

    procedure TForm1.Button1Click(Sender: TObject);

    Now if you press down and hold the (x) close button without closing the application and after some seconds
    remove the mouse from the (x) button (keep the mouse button down)
    the graph will stop moving. The value stops giving feedback also..

    But the strange thing is that in my other app the form1 is giving feedback from the values BUT the GUI freezes
    and when i stop press the (x) close button all the values rise (for example above 1000) !

    Anyway since the problem is gone i'm only curious why in my other app the timer keeps going when the whole app is freezed.

    I'll close this question soon :)

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Suggested Solutions

    In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
    Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    734 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

    18 Experts available now in Live!

    Get 1:1 Help Now