with this.oCaller .AnyProperty = 'SomeValue' .AnyObject.Value = 'SomeValue' AValue = .AnyObject.AnyProperty .AnyMethod(ParamList) endwithOne another unreliable method is to use caller form's scx name as reference. ie: If form1's scx is myform.scx :
*Modal form.Unload return ; trans(this.Destination.value)+chr(13)+; this.field1filter.value+chr(13)+; trans(this.field2filter.value)+chr(13)+; dtoc(this.field3filter.value,1)+chr(13)+; ttoc(this.field4filter.value,1)+chr(13)+; ttoc(this.StartDate.value,1)+chr(13)+; ttoc(this.EndDate.value,1) *Caller form local lcRetStr, lnDestination, ; lcFilter1, lnFilter2, ldFilter3, ltFilter4, ldStartDate, ldEndDate do form GetRepParams to lcRetStr && Calls the modal form * Parses on return local array arrRetVals[1] if alines(arrRetVals,lcRetVAl) = 7 && Expecting back 7 values wrapped lnDestination = val(arrRetVals[1]) lcFilter1 = arrRetVals[2] lnFilter2 = val(arrRetVals[3]) ldFilter3 = ctod(trans(arrRetVals[4],'@R ^9999/99/99')) ltFilter4 = ctot(trans(arrRetVals[5],'@R ^9999/99/99 99:99:99')) ldStartDate = ctod(trans(arrRetVals[6],'@R ^9999/99/99')) ldEndDate = ctod(trans(arrRetVals[7],'@R ^9999/99/99')) else && error handling - only development phase should need this if block endif-Array
*Modal form.Unload or might be OKbutton click, release etc whereever you like arrRetVals[1] = this.Destination.value arrRetVals[2] = this.field1filter.value arrRetVals[3] = this.field2filter.value arrRetVals[4] = this.field3filter.value arrRetVals[5] = this.field4filter.value arrRetVals[6] = this.StartDate.value arrRetVals[7] = this.EndDate.value *Caller form dimension arrRetVals[7] do form GetRepParams && Calls the modal form - array is in scope * On return local lnDestination, lcFilter1, ; lnFilter2, ldFilter3, ltFilter4, ldStartDate, ldEndDate lnDestination = arrRetVals[1] lcFilter1 = arrRetVals[2] lnFilter2 = arrRetVals[3] ldFilter3 = arrRetVals[4] ltFilter4 = arrRetVals[5] ldStartDate = arrRetVals[6] ldEndDate = arrRetVals[7]-Object (this is my favourite if I want to pass and get values)
*Modal form.init lparameters toCargo this.oCargo = toCargo && To keep in scope *Modal form assigns controlsources such as * could do in init code or directly using PEM sheet with this .Destination.controlsource = "this.oCargo.Destination" .field1filter.controlsource = "this.oCargo.Filter1" .field2filter.controlsource = "this.oCargo.Filter2" .field3filter.controlsource = "this.oCargo.Filter3" .field4filter.controlsource = "this.oCargo.Filter4" .StartDate.controlsource = "this.oCargo.StartDate" .EndDate.controlsource = "this.oCargo.EndDate" endwith *Caller form local loCargo create cursor dummy (Destination i,Filter1 c(10),Filter2 i,; Filter3 d,Filter4 t,StartDate d,EndDate d) scatter name loCargo blank use in 'dummy' do form GetRepParams with loCargo && Calls the modal form * On return has all the values in loCargo as property values. * ie: loCargo.DestinationYet another and effective way is not to return params but query from modal form objects. ie: Given the above report parameters modal form sample :
*Modal form is designed with no special code * other than OK and Cancel button *OK button code thisform.hide() *Cancel button code thisform.tag = 'User Cancelled' thisform.hide() *Caller form local loRepParams do form GetRepParams name loRepParams && Calls the modal form * Returns here as modal form is hidden - but it still exists * On return query modal form's object values * ie: if loRepParams.Tag = 'User Cancelled' && Take action for cancel *... else lnDestination = loRepParams.Destination.Value *... ldStartDate = loRepParams.StartDate.Value endif loRepParams.release() && Release the modal formPS: Sergey is right to avoid macro substitution. On an average 600-800 Mhz computer, if you create around 50K objects you get approximately one second performance penalty. Use store instead.