*-- MyBaseForm.Init(toSecurity) this.lInit = .T. this.oSecurity = toSecurity this.SetAll("oSecurity",toSecurity) *-- MyBaseForm.Refresh IF this.lInit *-- If form is initing, do the default *-- behavior (calling the refresh of all *-- objects on the form DoDefault() *-- Prevent default behavior from repeating *-- at the end of the method NODEFAULT *-- Set the flag to .F. to prevent *-- control Refresh calls from *-- syncing with security object this.lInit = .F. ENDIFThen in the refresh of the baseclass of your controls:
*-- MySpecialTextbox.Refresh IF thisform.lInit this.GetValueFromSecurityObject() && references this.oSecurity ENDIFThe only downside to this approach is that non-visible pages of pageframes do not refresh their controls. So you might need to put the following into the refresh() method of your base pageframe class:
*-- MySpecialPageFrame.Refresh IF thisform.lInit FOR EACH loPage IN this.Pages loPage.Refresh() ENDFOR NODEFAULT ENDIF2. I know you already considered a form array, but here is code that has the individual controls register themselves with the form, and it is pretty simple to implement. Create an array on the form object, and then in the inits of the controls call a method of the form that registers itself with the form. The form will need a property called nControlCount and an array property called aControls[1].
*-- MySpecialTextbox.Init thisform.Register(this) *-- MyBaseForm.Register(toControl) LPARAMETERS toControl this.nControlCount = this.nControlCount+1 DIMENSION this.aControls[this.nControlCount] this.aControls[this.nControlCount] = toControl *-- MyBaseForm.Init(toSecurity) this.oSecurity = toSecurity *-- loop through registered controls FOR EACH loControl IN this.aControls loControl.Synchronize(toSecurity) ENDFORA benefit of this registration technique would be that not all controls would need to register themselves, just the ones that need to deal with the security object. The controls could even have a property (lRegisterMe) that defaults to .F.:
*-- MySpecialTextbox.Init IF this.lRegisterMe thisform.Register(this) ENDIFThen you just need to set this property to .T. for the ones that need registering.