Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

StartAutoExpandTimer

Starts a timer for the specified item, so a SFTTREEN_AUTOEXPANDING notification will be sent.

C

BOOL WINAPI SftTree_StartAutoExpandTimer(HWND hwndCtl,
        int index,
        BOOL fDeselectedItemsOnly,
        UINT elapse);
BOOL WINAPI SftTreeSplit_StartAutoExpandTimer(HWND hwndCtl,
        int index,
        BOOL fDeselectedItemsOnly,
        UINT elapse);

C++

BOOL CSftTree::StartAutoExpandTimer(int index,
        BOOL fDeselectedItemsOnly,
        UINT elapse);
BOOL CSftTreeSplit::StartAutoExpandTimer(int index,
        BOOL fDeselectedItemsOnly,
        UINT elapse);

Parameters

hwndCtl

The window handle of the tree control.

index

Defines the zero-based index of the item, for which a SFTTREEN_AUTOEXPANDING notification will be sent once the timer expires.

fDeselectedItemsOnly

Set to TRUE to send a SFTTREEN_AUTOEXPANDING notification only if the item described by index is not selected. Otherwise, if fDeselectedItemsOnly is FALSE, the SFTTREEN_AUTOEXPANDING notification will be sent regardless of the selection status of the item.

elapse

Defines the time interval (in milliseconds) when the SFTTREEN_AUTOEXPANDING notification will be sent.

Returns

StartAutoExpandTimer returns TRUE if the function was successful, otherwise FALSE is returned.

Comments

The StartAutoExpandTimer function starts a timer for the specified item, so a SFTTREEN_AUTOEXPANDING notification will be sent.

This function is normally used during drag & drop processing to implement autoexpanding folders when the mouse cursor hovers over a collapsed folder. Once StartAutoExpandTimer is called, the SFTTREEN_AUTOEXPANDING notification will be sent after elapse milliseconds. If StartAutoExpandTimer is called again before the SFTTREEN_AUTOEXPANDING notification is sent, a pending timer is canceled and the timer is restarted.

StopAutoExpandTimer can be used to cancel the timer.

Once the SFTTREEN_AUTOEXPANDING notification is sent, the application can use the GetExpandCollapseIndex function to retrieve the index of the item to expand.

Examples

C

            lpInfo->fDropOK = TRUE;
            lpInfo->hCursor = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_DRAG));

            // update the drop target in the right tree
            pt = lpInfo->ptDrag;
            MapWindowPoints(HWND_DESKTOP, m_hwndRightTree, &pt, 1);
            index = SftTree_CalcIndexFromPointEx(m_hwndRightTree, &pt);
            SftTree_SetDropHighlight(m_hwndRightTree, index, TRUE);
            SftTree_StartAutoExpandTimer(m_hwndRightTree, index, FALSE, 0);

            // remember who is the drop target
            m_hwndLastTarget = m_hwndRightTree;
        }

    } else { // left side tree is the drop target
        // clear old drop target if different

C++

            lpInfo->fDropOK = TRUE;
            lpInfo->hCursor = AfxGetApp()->LoadCursor(IDC_DRAG);

            // update the drop target in the right tree
            CPoint pt = lpInfo->ptDrag;
            ::MapWindowPoints(HWND_DESKTOP, m_RightTree.m_hWnd, &pt, 1);
            int index = m_RightTree.CalcIndexFromPointEx(&pt);
            m_RightTree.SetDropHighlight(index, TRUE);
            m_RightTree.StartAutoExpandTimer(index, FALSE, 0);

            // remember who is the drop target
            m_lastDropTarget = &m_RightTree;
        }

    } else { // left side tree is the drop target
        // clear old drop target if different

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