Announcing Property Window Selection Tracking
If you want to work with the Properties window or the Property pages, for example, a form, text, or a selection for which you want to see properties, then you must have complete knowledge of how you coordinate selection. For example, you must know whether you have single selection or multiple selections. You then need to announce your selection type (single or multiple) to the IDE using the ITrackSelection interface. This interface provides information required by the Properties window.
To announce selection to the environment
Call
QueryInterface
for IServiceProvider.To do this, use the site pointer passed to the view when it was created.
Call
QueryService
from the view for theSID_STrackSelection
service.This returns a pointer to ITrackSelection.
Call the OnSelectChange method every time your selection changes, and pass a pointer to an object that implements ISelectionContainer.
The selection container object can use either single or multiple selections and contains the selection information in an
IDispatch
object. Calling the OnSelectChange method notifies the Properties window that the selection has changed. The Properties window then uses the objects on ISelectionContainer to determine whether single or multiple selections have occurred, and what the actual object selections are.If you specify a multiple selection, then the Properties window finds the intersection between common properties for the objects. If you specify a single object selection, then the Properties window displays all of the properties for the one object.