Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

IVsUIHierWinClipboardHelperEvents.OnClear Method

Signals that the clipboard has been cleared.

Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop (in microsoft.visualstudio.shell.interop.dll)

int OnClear (
	[InAttribute] int fDataWasCut
)
int OnClear (
	/** @attribute InAttribute() */ int fDataWasCut
)
function OnClear (
	fDataWasCut : int
) : int

Parameters

fDataWasCut

[in] This flag informs the source that the Cut method was called (true), rather than Copy (false), so the source knows whether to "un-cut-highlight" the items that were cut.

Return Value

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

COM Signature

From vsshell.idl:

HRESULT IVsUIHierWinClipboardHelperEvents::OnClear(
   [in] BOOL fDataWasCut
);

Usually a hierarchy that is informing the environment of a cut or copy operation by calling Cut or Copy also listens to IVsUIHierWinClipboardHelperEvents. However, the hierarchy might lose context on whether a cut or a copy operation was performed long before the paste or clear occurs. The IVsUIHierWinClipboardHelperEvents.OnClear method informs the hierarchy from which the object was cut or copied that a cut or copy was performed (as determined by the value of the fDataWasCut parameter). The hierarchy can then reset the "cut-highlight" state of any items that were placed on the clipboard.

One IDataObject at a time can be stored on the clipboard. When the contents of the clipboard change, and the cut IDataObject is no longer on the clipboard, the IVsUIHierWinClipboardHelperEvents.OnClear method of each listener is called so that the cut item can be undimmed by calling ExpandItem and specifying a value of EXPF_UnCutHighlightItem.

This notification is significant because the clipboard is only cleared when the user cuts or copies a different item to it. The clipboard is not cleared on a paste.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.