SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftPrintPreview/DLL 2.0 - Print Preview Control (discontinued)
SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftDirectory 3.5 - File/Folder Control (discontinued)
SftMask/OCX 7.0 - Masked Edit Control
SftOptions 1.0 - Registry/INI Control (discontinued)
SftPrintPreview/OCX 1.0 - Print Preview Control (discontinued)
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTabs/NET 6.0 - Tab Control (discontinued)
SftTree/NET 2.0 - Tree Control
Calculates the item index number given a point in tree control client area coordinates.
C
int WINAPI SftTree_CalcIndexFromPoint(HWND hwndCtl, LPPOINT lpPt); int WINAPI SftTree_CalcIndexFromPointEx(HWND hwndCtl, LPPOINT lpPt); int WINAPI SftTreeSplit_CalcIndexFromPoint(HWND hwndCtl, LPPOINT lpPt); int WINAPI SftTreeSplit_CalcIndexFromPointEx(HWND hwndCtl, LPPOINT lpPt);
C++
int CSftTree::CalcIndexFromPoint(LPPOINT lpPt) const; int CSftTree::CalcIndexFromPointEx(LPPOINT lpPt) const; int CSftTreeSplit::CalcIndexFromPoint(LPPOINT lpPt) const; int CSftTreeSplit::CalcIndexFromPointEx(LPPOINT lpPt) const;
hwndCtl
The window handle of the tree control.
lpPt
The x and y coordinates in pixels (relative to the upper left corner of the tree control), for which the item index number needs to be calculated.
The return value is the zero-based index of the item at the given location. The return value is -1 if no item is located at the specified point.
The CalcIndexFromPoint and CalcIndexFromPointEx functions calculate the item index number given a point in tree control client area coordinates.
If lpPt is at the bottom of the tree control above a partially visible item, CalcIndexFromPoint will return -1, CalcIndexFromPointEx returns the index of the item in this case.
CalcIndexFromPoint will return the index of the last item in the tree control if the lpPt location is above the empty area at the end of the item list. CalcIndexFromPointEx returns the index of the last item + 1 in this case.
If the location lpPt is in the column or row/column header area or outside the tree control client area, -1 is returned.
// set the drop OK cursor 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
// set the drop OK cursor 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
See Also C/C++ API | Categories | Notifications