Partager via


VSConstants.VSSELELEMID Enumeration

Constants used in IVsSelectionEvents to indicate a new selection state. The selections may be propagated through OnElementValueChanged.

Namespace:  Microsoft.VisualStudio
Assemblies:   Microsoft.VisualStudio.Shell.10.0 (in Microsoft.VisualStudio.Shell.10.0.dll)
  Microsoft.VisualStudio.Shell.9.0 (in Microsoft.VisualStudio.Shell.9.0.dll)
  Microsoft.VisualStudio.Shell (in Microsoft.VisualStudio.Shell.dll)

Syntax

'Déclaration
Public Enumeration VSSELELEMID
'Utilisation
Dim instance As VSConstants.VSSELELEMID
public enum VSSELELEMID
public enum class VSSELELEMID
type VSSELELEMID
public enum VSSELELEMID

Members

Member name Description
SEID_UndoManager IID_IUnknown of the active IOleUndoManager object.
SEID_WindowFrame Visual Studio tracks this selection automatically so it cannot be set via OnElementValueChanged, but the value may be observed by calling GetCurrentElementValue
SEID_DocumentFrame Visual Studio tracks this selection automatically so it cannot be set via OnElementValueChanged, but the value may be observed by calling GetCurrentElementValue
SEID_StartupProject IID_IUnknown of the active StartupProject.
SEID_PropertyBrowserSID IID_IUnknown of the active IVsPropertyBrowser.
SEID_UserContext An event that indicates selection only by document windows that do not push selection context to the property browser. The alternative case is VSFPROPID_UserContext.
SEID_ResultList IID_IUnknown of the active IOleCommandTarget for list navigation commands.
SEID_LastWindowFrame The value of SEID_WindowFrame before it received its current value. It is guaranteed to be different from SEID_WindowFrame unless both are empty.

Remarks

If your code only needs to know when a window is activated, first implement the IVsSelectionEvents interface then query the shell for the selection monitoring service. This means: QueryService the shell for the service SID_SVsShellMonitorSelection and its interface IID_IVsMonitorSelection, retrieving IVsMonitorSelection. Next on that interface IVsMonitorSelection call AdviseSelectionEvents and send it a pointer to the IVsSelectionEvents handler that you implemented above. In your handler for the OnElementValueChanged call, look for elementid == SEID_WindowFrame or elementid == SEID_DocumentFrame. Test the varValueNew parameter for a pointer to the window frame you are looking for. The following describes the significance of the OnElementValueChanged values:

SEID_WindowFrame

Fires for both tool window and document window activation.

SEID_DocumentFrame

Fires only for document window activation.

To get more selection information implement the IVsWindowFrameNotify interface. In previous versions of Visual Studio only the object set as the VSFPROPID_ViewHelper object was available. Visual Studio contains the new interface IVsWindowFrame2 which allows multiple parties to subscribe to these events.

Notes

These element IDs are the only element IDs that can be used with the selection service. Do not attempt to pass any other element IDs.

Notes

SEID_UserContext should be used only by document windows that do not push selection context to the property browser see VSFPROPID_UserContext for the alternative case.

Notes

You can also use this mechanism to detect when you lose selection

See Also

Reference

Microsoft.VisualStudio Namespace