Condividi tramite


CListBox::GetTopIndex

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

int GetTopIndex( ) const;

Return Value

The zero-based index of the first visible item in a list box if successful, LB_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 n = m_myListBox.GetCount()/2;
if (m_myListBox.GetTopIndex() < n)
{
   m_myListBox.SetTopIndex(n);
   ASSERT(m_myListBox.GetTopIndex() == n);
}

Requirements

Header: afxwin.h

See Also

Concepts

CListBox Class

CListBox Members

Hierarchy Chart

CListBox::SetTopIndex

LB_GETTOPINDEX