Google Groups Home
Help | Sign in
calculating on the fly
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
robin.do...@dpi.nsw.gov.au  
View profile
 More options Jan 14, 6:06 pm
Newsgroups: comp.lang.pascal.delphi.databases
From: robin.do...@dpi.nsw.gov.au
Date: Mon, 14 Jan 2008 15:06:02 -0800 (PST)
Local: Mon, Jan 14 2008 6:06 pm
Subject: calculating on the fly
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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
DB-1  
View profile
 More options Jan 15, 4:28 am
Newsgroups: comp.lang.pascal.delphi.databases
From: DB-1 <d...@newsgroups.only.com>
Date: Tue, 15 Jan 2008 11:28:50 +0200
Local: Tues, Jan 15 2008 4:28 am
Subject: Re: calculating on the fly

robin.do...@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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google