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
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