Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

DragInfo

Returns drag & drop operation information in a SFTTREE_DRAGINFO structure.

C

LPSFTTREE_DRAGINFO WINAPI SftTree_GetDragInfo(HWND hwndCtl);
LPSFTTREE_DRAGINFO WINAPI SftTreeSplit_GetDragInfo(HWND hwndCtl);

C++

LPSFTTREE_DRAGINFO CSftTree::GetDragInfo() const;
LPSFTTREE_DRAGINFO CSftTreeSplit::GetDragInfo() const;

Parameters

hwndCtl

The window handle of the tree control.

Returns

The return value is a pointer to a SFTTREE_DRAGINFO structure.

Comments

The GetDragInfo function returns drag & drop operation information in a SFTTREE_DRAGINFO structure.

A tree control must be defined using the SFTTREESTYLE_DRAGDROP window style to support drag & drop.

The SFTTREE_DRAGINFO structure returned is only valid if the calling application is currently processing a SFTTREEN_BEGINDRAG, SFTTREEN_DRAGGING, SFTTREEN_ENDDRAG or SFTTREEN_CANCELDRAG notification. When processing multiple notifications, the SFTTREE_DRAGINFO structure has to be retrieved using GetDragInfo every time. The address of the retrieved SFTTREE_DRAGINFO structure cannot be considered valid after processing one notification.

Some fields in the structure may be modified if the application is currently processing a SFTTREEN_BEGINDRAG or SFTTREEN_DRAGGING notification.

Examples

C

/**********************************************************************/
/*                      Left Tree Control Handling                    */
/**********************************************************************/

static void DraggingLeft()
{
    /* Drag & drop in progress, which was started on the left side tree */
    LPSFTTREE_DRAGINFO lpInfo;
    lpInfo = SftTree_GetDragInfo(m_hwndLeftTree);

    if (lpInfo->hwnd != m_hwndLeftTree) { // The target is another window

        // clear old drop target
        if (m_hwndLastTarget) {
            SftTree_SetDropHighlight(m_hwndLastTarget, -1, FALSE);
            SftTree_StopAutoExpandTimer(m_hwndLastTarget);

C++

void CSampleDlg::OnEndDragLeft()
{
    /* The user dropped something */

    LPSFTTREE_DRAGINFO lpInfo;
    int index;
    CString str, text;

    lpInfo = m_LeftTree.GetDragInfo();

    if (lpInfo->hwnd != m_LeftTree.m_hWnd) { // The target is another window

        // In this example the "other" control could be the right tree control

        if (lpInfo->hwnd == m_RightTree.m_hWnd) { // target is left tree
            index = m_RightTree.GetDropHighlight();

See Also C/C++ API | Categories | Notifications