Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

ResizeColumn

Returns the column number of the column being resized.

C

int WINAPI SftTree_GetResizeColumn(HWND hwndCtl);
int WINAPI SftTreeSplit_GetResizeColumn(HWND hwndCtl);

C++

int CSftTree::GetResizeColumn() const;
int CSftTreeSplit::GetResizeColumn() const;

Parameters

hwndCtl

The window handle of the tree control.

Returns

GetResizeColumn returns the zero-based column number of the column being affected by the current notification. If a split tree control is used, the return value can be -1 indicating that the splitter bar was used to resize the left and right panes or the splitter bar was double-clicked.

Comments

The GetResizeColumn function returns the column number of the column being resized.

GetResizeColumn can be used while processing a SFTTREEN_COLUMNSIZE or SFTTREEN_LBUTTONDBLCLK_COLUMNRES notification to determine whether the splitter bar or a column was affected by the current event.

Examples

C

                case SFTTREEN_EXPANDALL: { // expand all
                    int index;
                    index = SftTree_GetExpandCollapseIndex(hwndCtl);/* Get item to expand/collapse */
                    SftTree_Expand(hwndCtl, index, TRUE, TRUE);
                    break;
                 }
                case SFTTREEN_LBUTTONDBLCLK_COLUMNRES: {
                    /* Resize column optimally */
                    int realCol = SftTree_GetResizeColumn(g_hwndTree);
                    if (realCol >= 0) {
                        SftTree_MakeColumnOptimal(g_hwndTree, realCol);/* Make column width optimal */
                        SftTree_RecalcHorizontalExtent(g_hwndTree);/* Update horizontal scroll bar */
                    }
                    break;
                  }
                case SFTTREEN_SELCHANGE:

C++

/* Respond to events as the user double-clicks on the      */
/* column resizing area.  The events handled here can be   */
/* changed to suit your application.                       */

void CSampleView::OnLButtonDblClkColumnResize()
{
    /* Resize column optimally */
    int realCol = m_Tree.GetResizeColumn();
    if (realCol >= 0) {
        m_Tree.MakeColumnOptimal(realCol);/* Make column width optimal */
        m_Tree.RecalcHorizontalExtent(0, FALSE);/* Update horizontal scroll bar */
    }
}

void CSampleView::OnSelChange()
{

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