HeaderPane
Main
Hide
Share Link
Print

ExpandCollapseIndex

Returns the zero-based index of the item to expand/collapse.

C

int WINAPI SftBox_GetExpandCollapseIndex(HWND hwndCtl);

C++

int CSftBox::GetExpandCollapseIndex() const;

Parameters

hwndCtl

The window handle of the combo box control.

Returns

GetExpandCollapseIndex returns the zero-based index of the item to expand/collapse.

Comments

The GetExpandCollapseIndex function returns the zero-based index of the item to expand/collapse.

GetExpandCollapseIndex is used while handling notifications such as SFTBOXN_LBUTTONDOWN_BUTTON and SFTBOXN_LBUTTONDBLCLK_BUTTON, to determine which item in the dropdown portion to expand or collapse. It returns the index of the item whose expand/collapse button was (double-)clicked.

The item can then be expanded or collapsed using Expand, Collapse or SetItemExpand.

Examples

C View entire sample code

/*                     Expanding and Collapsing                       */
/**********************************************************************/

// The combo box reports a click on an expand/collapse button, the
// application expands or collapses the item.

static void ExpandCollapse(HWND hwndBox)
{
    int index = SftBox_GetExpandCollapseIndex(hwndBox);
    if (index >= 0)
        SftBox_SetItemExpand(hwndBox, index, !SftBox_GetItemExpand(hwndBox, index), FALSE);
}

/**********************************************************************/
/*                           Dialog Proc                              */
/**********************************************************************/

C++ View entire sample code

    m_Devices.SetCurSel(0);
}

// The combo box reports a click on an expand/collapse button, the
// application expands or collapses the item.

void CMainDlg::OnFoldersExpandCollapse()
{
    int index = m_Folders.GetExpandCollapseIndex();
    if (index >= 0)
        m_Folders.SetItemExpand(index, !m_Folders.GetItemExpand(index), FALSE);
}

BOOL CMainDlg::OnInitDialog()
{
    CDialog::OnInitDialog();

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


Last Updated 11/21/2026 - (email)
© 2026 Softel vdm, Inc.