Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

DisplayHeaderDropDownRect

Returns the dimensions of the column header dropdown/filter button.

C

BOOL WINAPI SftTree_GetDisplayHeaderDropDownRect(HWND hwndCtl, int realCol, LPRECT lpRect);
BOOL WINAPI SftTreeSplit_GetDisplayHeaderDropDownRect(HWND hwndCtl, int realCol, LPRECT lpRect);

C++

BOOL CSftTree:GetDisplayHeaderDropDownRect(int dispCol, LPRECT lpRect) const;
BOOL CSftTreeSplit:GetDisplayHeaderDropDownRect(int dispCol, LPRECT lpRect) const;

Parameters

hwndCtl

The window handle of the tree control.

realCol

The zero-based column number whose location is to be retrieved.

lpRect

A pointer to a RECT structure where the location of the requested column header dropdown/filter button is returned.

Returns

The return value is TRUE if the function was successful, otherwise FALSE is returned.

Comments

The GetDisplayHeaderDropDownRect function returns the dimensions of the column header dropdown/filter button.

The coordinates returned in lpRect are coordinates relative to the tree control's client area (in pixels).

The dimensions of the entire header area can be retrieved using GetHeaderRect.

Examples

C

                    break;
                  }
                case SFTTREEN_LBUTTONDOWN_COLUMN_HEADERDD:
                case SFTTREEN_LBUTTONDBLCLK_COLUMN_HEADERDD: {
                    /* The user clicked/double-clicked the header dropdown/filter */
                    int col = SftTree_GetHeaderButton(g_hwndTree);
                    if (col >= 0) {
                        RECT rect;
                        if (SftTree_GetDisplayHeaderDropDownRect(g_hwndTree, col, &rect)) {
                            MapWindowPoints(g_hwndTree, GetDesktopWindow(), (LPPOINT)&rect, 2);
                            ShowHeaderMenu(hwnd, g_hwndTree, rect.left, rect.bottom);
                        }
                    }
                    break;
                  }
                }

C++

}

/* Colummn Dropdown/Filter was clicked */
void CSampleView::OnColumnHeaderDDClick()
{
	int col = m_Tree.GetHeaderButton();
	if (col >= 0) {
		CRect rect;
		if (m_Tree.GetDisplayHeaderDropDownRect(col, &rect)) {
			m_Tree.MapWindowPoints(NULL, &rect);
			ShowHeaderMenu(CPoint(rect.left, rect.bottom));
		}
	}
}

/*------------------------------------------------------------------------------*/

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