Data selection

A canvas selection is a collection (ordered list) of the MCanvasGraphic instances in a particular canvas representation. There can be any number of selections in a GrafEdit application at any given time. A selection does not own the canvas graphics in the selection. The canvas graphics are known to the canvas selection by their IDs.

As shown in Figure 37, TStandardCanvasModel derives from MCanvasSelection and TModelSelection. Mixing MCanvasSelection with TModelSelection allows TStandardCanvasSelection to select data in a model. Mixing in MDataExchanger provides clipboard support for cut, copy, and paste operations without your having to write code to implement those operations.


Canvas selections are the targets of commands in GrafEdit. All GrafEdit commands are derived from the template TCommandOn<MCanvasSelection> where MCanvasSelection is the abstract base class for canvas selections. Each command instance has functions for doing, undoing, and redoing the command action on the MCanvasSelection. A typical GrafEdit command iterates over the canvas selection to which it is bound, and performs an action on all, or some of the canvas graphics in the selection.

Any concrete selection class, such as TStandardCanvasSelection, that mixes in MCanvasSelection behavior supports any command of type TCommandOn so that you can create custom selection classes without having to rewrite any of the GrafEdit command classes. MCanvasSelection has default implementations for all functions except GetCanvasSelection and Invalidate, which must be implemented in the derived classes.


[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