>
> >NotifyObserversHelper
>
> Hahaha, if I had of watched for two more minutes. It's all explained when
> you add the Quantities property to TLineItem. Sorry about that.
>
No problem. I added NotifyObserversHelper as a convenience instead of having
to use the BeginUpdate, try..finally, EndUpdate construct. It uses a
reference counted interface to do that for you (in its constructor and
destructor). You can use it within the property setter or in other classes
or GUI code that references the object, either with a simple
NotifyObserversHelper call after a single change is made, or hang on to the
interface before making multiple changes to the object and having it
explicitly or automatically de-referenced after the changes.
e.g. Within property setters:
procedure TMyClass.SetSomeProperty(const AValue: Integer);
begin
FSomeProperty := AValue;
NotifyObserversHelper;
end;
procedure TMyClass.SetSomeProperty(const AValue: Integer);
var
LHelper: ItiNotifyObserversHelper;
begin
LHelper := NotifyObserversHelper;
FSomeProperty := AValue;
SomeOtherProperty := AValue * 2; // Invokes another setter
// Auto de-reference
end;
or elsewhere outside the class:
var
LHelper: ItiNotifyObserversHelper;
LMyObject: TMyClass;
...
LHelper := LMyObject.NotifyObserversHelper;
LMyObject.SomeProperty := 100;
LMyObject.SomeOtherProperty := 200;
LHelper := nil; // Optional explicit de-reference
What NotifyObserversHelper and BeginUpdate/EndUpdate give you is a single
observer notification for multiple changes to avoid things like multiple UI
updates in MGM.
Regards,
Jarrod Hollingworth
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
tiOPF-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tiopf-talk