[DUG] Which event to use

Charlie kerscher at bellsouth.net
Sun Oct 18 10:27:08 NZDT 2009


I'm using BDS 2006, InfoPower dbGrid and InfoPower dbComboLookups. My
application is for orders that are placed to purchase the manufactured
drawer boxes and uses master-detail tables; namely orders and orderdetail.
Some of the detail data is entered in either dbEdits or dbLookups. These are
used for data that is the same for each detail record. The dbGrid is used
for the particulars for the items to be manufactured; namely, quantity,
width, depth, height, and up to 7 options, the square foot price for the
drawer box and the extended price (computed as square foot price * quantity
+ cost of the options selected). To determine the square foot price the
program has to use the type of wood chosen for the drawer boxes, the height
of the box, the price table and determine if the square feet for the box is
greater than the minimum 1.5 square feet.

Sometimes the program finds the correct price and sometimes it doesn't on
the same order. I have a procedure that 'calculates' the price. I think that
perhaps I'm over calling this procedure. 

The fields for the order and orderdetail tables are persistent.

Currently there are several infopower lookup controls which have an
OnCloseUp event. Some of these are attached to the infopower grid. The
'calculate' procedure is called in this event. The persistent fields call
the 'calculate' procedure in the OnValidate and/or the OnExit event. And to
top this off I have the dbGrid calling the 'calculate' procedure for the
OnCellChange event. I guess I wanted to get the price figured out no matter
what happened, lol. 

So the question is: What is the way I'm supposed to get the price figured
out? Namely, do I use the DataSet's OnDataChange event, do I use the
persistent fields' OnValidate event or is it better to use the OnChange
event, do I use the dbGrid's OnCellChange event, or do I use the controls
OnExit or OnCloseUp event. Or should I do something different?

 

I've learned that most folks recommend against using a dbGrid the way that I
am; but my bottom line is I need for each record to have the correct square
foot price and the corresponding total for that record.

Thank you for any help.

Charlie

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20091017/e8a41c69/attachment.html 


More information about the Delphi mailing list