?
Solved

Process Messages

Posted on 2006-05-19
2
Medium Priority
?
160 Views
Last Modified: 2010-04-05
Hi.

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.
0
Comment
Question by:CodedK
2 Comments
 
LVL 17

Accepted Solution

by:
geobul earned 500 total points
ID: 16723400
Hi,

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;

var
  count: integer = 0;

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

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
0
 
LVL 16

Author Comment

by:CodedK
ID: 16724736
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 :
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
implementation

uses Unit2;

{$R *.dfm}

procedure TForm1.Timer1Timer(Sender: TObject);
begin
Inc(i);
Flow:=Random(1000);
If Flow>Max then Max:=Flow; // This value will never go above 1000.
Form2.Label1.Caption:='Current Max : '+IntToStr(Max);
Form2.Chart1.SeriesList.Series[0].AddXY(i,Max);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
Timer1.Enabled:=True;
Form2.Show;
end;
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-

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 :)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Integration Management Part 2
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses
Course of the Month16 days, 18 hours left to enroll

862 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