Thanks for sending the information privately. This is do-able, it just needs a little bit of set up.
Since you're using a multi-page form and want to call your recalculation code from any object on each of these pages, you're going to want to start by creatine custom methods on the form. Create one for each type of calculation.
That's the easy part. Now, we need to work out how best to call the code inside those custom methods. There are couple of things that will help. Let's review a few different tidbits about the way Paradox handles things and then we'll look at how we can use these to solve the overall problem.
First, the event model. Recall that Paradox first sends all events to the form object, regardless of the object that triggered the event. this lets you place code at the form level that is triggered by multiple objects.
For example, if you place code in the depart event of the form object, it will fire as focus moves from object to object. If you've placed code on in a built-in event of the form, you may have seen a construct like this:
Code:
if eventInfo.isPreFilter() then
else
endIf
The IF portion of this is fires when Paradox is dispatching the event. You can use this to determine whether or not to take a global action, e.g. recalculate your totals, as follows:
Code:
if eventInfo.isPreFilter() then
active.postAction( userAction + 1 )
endIf
Active, as you probably know, is the object that has focus.
This places a request to trigger a custom action _after_ the current event has finished processing In this case, after focus has departed the active field. This will help you avoid running into problems with the refresh/recalc cycle.
To add code to this action, place the following in the action event of the form object:
Code:
if eventInfo.isPreFilter() then
else
if eventInfo.id() = ( userAction + 1 ) then
if subject.class() = "EditRegion" OR
subject.class() = "Field" then
switch
case subject.TableName = "QuoteMst.DB" :
recalcMaster()
case subject.TableName = "QuoteItem.DB" :
recalcItem()
case subject.TableName = "QuoteItmDtl.DB" :
recalcDetail()
endSwitch
endIf
endIf
endIf
Subject may be new to you; it's the object that triggered this event, e.g. the one we sent the postAction to.
This lets you choose which custom method to call with the custom action is fired. You can also add in other flags and/or conditions.
Note that I verified that active was actually an unlabelled field object or the edit region of a labelled field object before calling the TableName property. This prevents the problems you might have if the object being departed was, say, a button or other non-data object.
Hope this helps...
-- Lance