Compartilhar via


CComboBox::GetTopIndex

Retrieves the zero-based index of the first visible item in the list-box portion of the combo box.

int GetTopIndex( ) const;

Return Value

The zero-based index of the first visible item in the list-box portion of the combo box if successful, CB_ERR otherwise.

Remarks

Initially, item 0 is at the top of the list box, but if the list box is scrolled, another item may be at the top.

Example

// Want an item in the bottom half to be the first visible item.
int nTop = m_pComboBox->GetCount() / 2;
if (m_pComboBox->GetTopIndex() < nTop)
{
   m_pComboBox->SetTopIndex(nTop);
   ASSERT(m_pComboBox->GetTopIndex() == nTop);
}

Requirements

Header: afxwin.h

See Also

Reference

CComboBox Class

Hierarchy Chart

CComboBox::SetTopIndex

CB_GETTOPINDEX

Other Resources

CComboBox Members