CMFCTabDropTarget Class
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at CMFCTabDropTarget Class.
Provides the communication mechanism between a tab control and the OLE libraries.
class CMFCTabDropTarget : public COleDropTarget
Public Constructors
| Name | Description |
CMFCTabDropTarget::CMFCTabDropTarget | Default constructor. |
Public Methods
| Name | Description |
| CMFCTabDropTarget::OnDragEnter | Called by the framework when the user drags an object into a tab window. (Overrides COleDropTarget::OnDragEnter.) |
| CMFCTabDropTarget::OnDragLeave | Called by the framework when the user drags an object outside of the tab window that has focus. (Overrides COleDropTarget::OnDragLeave.) |
| CMFCTabDropTarget::OnDragOver | Called by the framework when the user drags an object onto the tab window that has focus. (Overrides COleDropTarget::OnDragOver.) |
| CMFCTabDropTarget::OnDropEx | Called by the framework when the user releases the mouse button at the end of a drag operation. (Overrides COleDropTarget::OnDropEx.) |
| CMFCTabDropTarget::Register | Registers the control as one that can be the target of an OLE drag-and-drop operation. |
Remarks
This class provides drag-and-drop support to the CMFCBaseTabCtrl class. If your application initializes the OLE libraries by using the [AfxOleInit]--brokenlink--(../Topic/not%20found.md#afxoleinit) function, CMFCBaseTabCtrl objects register themselves for drag-and-drop operations.
The CMFCTabDropTarget class extends its base class by making the tab that is under the cursor when a drag operation occurs active. For more information about drag-and-drop operations, see Drag and Drop (OLE).
The following example demonstrates how to construct a CMFCTabDropTarget object and use its Register method.
HWND hWndTab = NULL; CBasePane* basePane = new CBasePane(); CMFCBaseTabCtrl* pTabParent = basePane->GetParentTabWnd(hWndTab); CMFCTabDropTarget* dropTarget = new CMFCTabDropTarget(); dropTarget->Register(pTabParent);
Header: afxbasetabctrl.h
Called by the framework when the user drags an object into a tab window.
virtual DROPEFFECT OnDragEnter(
CWnd* pWnd,
COleDataObject* pDataObject,
DWORD dwKeyState,
CPoint point);
Parameters
| Parameter | Description |
[in] pWnd | Unused. |
[in] pDataObject | A pointer to the object that the user drags. |
[in] dwKeyState | Contains the state of the modifier keys. This is a combination of any number of the following: MK_CONTROL, MK_SHIFT, MK_ALT, MK_LBUTTON, MK_MBUTTON, and MK_RBUTTON. |
[in] point | The location of the cursor in client coordinates. |
Return Value
The effect that results if the drop occurs at the location specified by point. It can be one or more of the following:
DROPEFFECT_NONEDROPEFFECT_COPYDROPEFFECT_MOVEDROPEFFECT_LINKDROPEFFECT_SCROLL
Remarks
This method returns DROPEFFECT_NONE if the toolbar framework is not in customization mode or the Clipboard data format is unavailable. Otherwise, it returns the result of calling CMFCBaseTabCtrl::OnDragEnter with the provided parameters.
For more information about customization mode, see CMFCToolBar::IsCustomizeMode. For more information about Clipboard data formats, see COleDataObject::IsDataAvailable.
Called by the framework when the user drags an object outside of the tab window that has focus.
virtual void OnDragLeave(CWnd* pWnd);
Parameters
| Parameter | Description |
[in] pWnd | Unused. |
Remarks
This method calls the CMFCBaseTabCtrl::OnDragLeave method to perform the drag operation.
Called by the framework when the user drags an object onto the tab window that has focus.
virtual DROPEFFECT OnDragOver(
CWnd* pWnd,
COleDataObject* pDataObject,
DWORD dwKeyState,
CPoint point);
Parameters
| Parameter | Description |
[in] pWnd | Unused. |
[in] pDataObject | A pointer to the object that the user drags. |
[in] dwKeyState | Contains the state of the modifier keys. This is a combination of any number of the following: MK_CONTROL, MK_SHIFT, MK_ALT, MK_LBUTTON, MK_MBUTTON, and MK_RBUTTON. |
[in] point | The location of the mouse pointer in client coordinates. |
Return Value
The effect that results if the drop occurs at the location specified by point. It can be one or more of the following:
DROPEFFECT_NONEDROPEFFECT_COPYDROPEFFECT_MOVEDROPEFFECT_LINKDROPEFFECT_SCROLL
Remarks
This method makes the tab that is under the cursor when a drag operation occurs active. It returns DROPEFFECT_NONE if the toolbar framework is not in customization mode or the Clipboard data format is unavailable. Otherwise, it returns the result of calling CMFCBaseTabCtrl::OnDragOver with the provided parameters.
For more information about customization mode, see CMFCToolBar::IsCustomizeMode. For more information about Clipboard data formats, see COleDataObject::IsDataAvailable.
Called by the framework when the user releases the mouse button at the end of a drag operation.
virtual DROPEFFECT OnDropEx(
CWnd* pWnd,
COleDataObject* pDataObject,
DROPEFFECT dropEffect,
DROPEFFECT dropList,
CPoint point);
Parameters
| Parameter | Description |
[in] pWnd | Unused. |
[in] pDataObject | A pointer to the object that the user drags. |
[in] dropEffect | The default drop operation. |
[in] dropList | Unused. |
[in] point | The location of the mouse pointer in client coordinates. |
Return Value
The resulting drop effect. It can be one or more of the following:
DROPEFFECT_NONEDROPEFFECT_COPYDROPEFFECT_MOVEDROPEFFECT_LINKDROPEFFECT_SCROLL
Remarks
This method calls CMFCBaseTabCtrl::OnDrop if the toolbar framework is in customization mode and the Clipboard data format is available. If the call to CMFCBaseTabCtrl::OnDrop returns a nonzero value, this method returns the default drop effect specified by dropEffect. Otherwise, this method returns DROPEFFECT_NONE. For more information about drop effects, see COleDropTarget::OnDropEx.
For more information about customization mode, see CMFCToolBar::IsCustomizeMode. For more information about Clipboard data formats, see COleDataObject::IsDataAvailable.
Registers the control as one that can be the target of an OLE drag-and-drop operation.
BOOL Register(CMFCBaseTabCtrl *pOwner);
Parameters
| Parameter | Description |
[in] pOwner | The tab control to register as a drop target. |
Return Value
Nonzero if registration was successful; otherwise 0.
Remarks
This method calls COleDropTarget::Register to register the control for drag-and-drop operations.