CMFCTabDropTarget Class
Provides the communication mechanism between a tab control and the OLE libraries.
Syntax
class CMFCTabDropTarget : public COleDropTarget
Members
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 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 OLE drag and drop.
Example
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);
Inheritance Hierarchy
Requirements
Header: afxbasetabctrl.h
CMFCTabDropTarget::OnDragEnter
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
pWnd
[in] Unused.
pDataObject
[in] A pointer to the object that the user drags.
dwKeyState
[in] 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.
point
[in] 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_NONE
DROPEFFECT_COPY
DROPEFFECT_MOVE
DROPEFFECT_LINK
DROPEFFECT_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.
CMFCTabDropTarget::OnDragLeave
Called by the framework when the user drags an object outside of the tab window that has focus.
virtual void OnDragLeave(CWnd* pWnd);
Parameters
pWnd
[in] Unused.
Remarks
This method calls the CMFCBaseTabCtrl::OnDragLeave
method to perform the drag operation.
CMFCTabDropTarget::OnDragOver
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
pWnd
[in] Unused.
pDataObject
[in] A pointer to the object that the user drags.
dwKeyState
[in] 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.
point
[in] 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_NONE
DROPEFFECT_COPY
DROPEFFECT_MOVE
DROPEFFECT_LINK
DROPEFFECT_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.
CMFCTabDropTarget::OnDropEx
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
pWnd
[in] Unused.
pDataObject
[in] A pointer to the object that the user drags.
dropEffect
[in] The default drop operation.
dropList
[in] Unused.
point
[in] 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_NONE
DROPEFFECT_COPY
DROPEFFECT_MOVE
DROPEFFECT_LINK
DROPEFFECT_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.
CMFCTabDropTarget::Register
Registers the control as one that can be the target of an OLE drag-and-drop operation.
BOOL Register(CMFCBaseTabCtrl *pOwner);
Parameters
pOwner
[in] 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.
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for