pascal - Repeated setters logic in Delphi -
For each setter of a class, I have to apply some event logic (On Chengning, On Changing):
"post-text" itemprop = "text" TBlock.SetWeightIn process (const value: double); Var oldview: double; Start Oldwell: = FWite In; DoOnChanging (OldValue, Value); FWeightIn: = value; DoOnChanged (OldValue, Value); End; Process TBlock.SetWeightOut (const value: double); Var oldview: double; Start OldValue: = FWightight; DoOnChanging (OldValue, Value); FWeightOut: Value =; DoOnChanged (OldValue, Value); End;
Can you recommend a way to apply it without repeating all these rows for each setter?
Try it out:
Process TBlock.SetField (var field: Double; constant value: double); Var oldview: double; Start OldWell: Field; DoOnChanging (OldValue, Value); Field: = Value; DoOnChanged (OldValue, Value); End; TBlock.SetWeightIn process (const value: double); Start Setfield (FWeightIn, Value); End; Process TBlock.SetWeightOut (const value: double); Start Setfield (FWeightOut, Value); End;