Returns the zero-based index of the item to expand/collapse.
C
int WINAPI SftBox_GetExpandCollapseIndex(HWND hwndCtl);
C++
int CSftBox::GetExpandCollapseIndex() const;
hwndCtl
The window handle of the combo box control.
GetExpandCollapseIndex returns the zero-based index of the item to expand/collapse.
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.
/* 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 */ /**********************************************************************/
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