Form::Init * -- Use this "SET PROCEDURE" technique if using a "STANDARD" method to calculate *------------------------------------------------------------------------------ if atc('\MySpecialCalc.',set('Procedure') = 0 && Check for "Standard" procedure set procedure to MySpecialCalc additive endif *------------------------------------------------------------------------------ Bindevent(this.txtMyValue1,"lostfocus",this,"CalcResult",1) Bindevent(this.txtMyValue2,"lostfocus",this,"CalcResult",1) Bindevent(this.txtMyValue3,"lostfocus",this,"CalcResult",1) * -- Initially calculate the result *------------------------------------------------------------------------------ this.CalcResult() *------------------------------------------------------------------------------Add new method to the form and/or use a "standard" procedure to calculate the result. If this calculation is used in various places in your system it would be advisable to make a "standard" procedure.
Form::CalcResult <pre> with this .txtMyValue4.value=.txtMyValue1.value + .txtMyValue2.value + .txtMyValue3.value endwithOr
with this This.txtMyValue4.value=MySpecialCalc(.txtMyValue1.value, .txtMyValue2.value,.txtMyValue3.value) endwith>For this purpose, Bindevent is perfect!
>This.value=this.parent.txtMyValue1.value + this.parent.txtMyValue2.value + this.parent.txtMyValue3.value>Add these lines to your form, for instance in the Gotfocus method:
>Bindevent(thisform.txtMyValue1,"interactivechange",thisform.txtResult,"refresh") >Bindevent(thisform.txtMyValue2,"interactivechange",thisform.txtResult,"refresh") >Bindevent(thisform.txtMyValue3,"interactivechange",thisform.txtResult,"refresh")>Then whenever you change any of the values in txtMyValue1, txtMyValue2 or txtMyValue3, txtResult will also get updated.