Sender brackets notifications

This example adds a new member function, AdoptShapes, to the interface of TShapeList. It takes a sequence of shapes to adopt rather than a single shape.

The implementation of AdoptShapes brackets notifications with calls to BeginNotification and EndNotification. This causes the notifier to send a batched notification containing the separate notifications to receivers that have requested batched notifications.

      void TShapeList::AdoptShapes(TSequenceOf<MGraphic>& shapesToAdopt)
      {
          BeginNotification();
          TDeleterFor<TIteratorOver<MGraphic> > iterator = shapesToAdopt.CreateIterator();
          for (MGraphic* shape = iterator->First(); shape; shape = iterator->Next()) {
              AdoptShape(shape);
          }
          EndNotification();
      }

[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker