Export (0) Print
Expand All

CListBox::GetTopIndex

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

int GetTopIndex( ) const;

The zero-based index of the first visible item in a list box if successful, LB_ERR otherwise.

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.


// 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);
}


Header: afxwin.h

Community Additions

ADD
Show:
© 2014 Microsoft