Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

calculating on the fly

1 view
Skip to first unread message

robin...@dpi.nsw.gov.au

unread,
Jan 14, 2008, 6:06:02 PM1/14/08
to
Dear All,

Have an app that requires the user to enter information on 3 tedits
and 1 tcombobox. An equation is then used to calculate the
relationship between the inputs. However, the users request is not to
have a calculate button. They wish the app to calculate the result on
the fly. That as the user enters the information.

This must be possible as I have seen it before but have no idea how to
code such a feature. My guess is using the components "onenter"
"onexit" features but searching has revealed limited code and info for
this.

I am sure this has probably been requested before but have been unable
to access it.

Many thanks in advance.

Robin

DB-1

unread,
Jan 15, 2008, 4:28:50 AM1/15/08
to
robin...@dpi.nsw.gov.au wrote:
>
> They wish the app to calculate the result on
> the fly. That as the user enters the information.

Here's one generic style approach. All the calculations are performed
when the user Exits each of the Controls.

procedure TForm1.ediPriceWith1TaxExit(Sender: TObject);
begin
...
UpdateOtherValues(Sender);
end;

procedure TForm1.ediPriceWith2TaxExit(Sender: TObject);
begin
...
UpdateOtherValues(Sender);
end;


procedure TForm1.UpdateOtherValues(Sender: TObject);
begin
if (Sender = ediPriceWith2Tax) then
...
if (Sender = ediPriceWithTax2) then
...
if (Sender = ediPriceWithTax3) then
...
end;

The Sender parameter passes the information on which Control the OnExit
event has happened. And the contents of all the other Controls will be
updated accordingly.

As said, this is generic, pascal style. Someone may have more
sophisticated solution to this.
DB-1

0 new messages