Partager via


IVsUIHierWinClipboardHelperEvents.OnClear(Int32) Method

Definition

Signals that the clipboard has been cleared.

public:
 int OnClear(int fDataWasCut);
public:
 int OnClear(int fDataWasCut);
int OnClear(int fDataWasCut);
public int OnClear (int fDataWasCut);
abstract member OnClear : int -> int
Public Function OnClear (fDataWasCut As Integer) As Integer

Parameters

fDataWasCut
Int32

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

Returns

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

Remarks

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.

Applies to