Export (0) Print
Expand All

CListBox::SetAnchorIndex

Sets the anchor in a multiple-selection list box to begin an extended selection.

void SetAnchorIndex(
   int nIndex 
);

nIndex

Specifies the zero-based index of the list-box item that will be the anchor.

In a multiple-selection list box, the anchor item is the first or last item in a block of contiguous selected items.


void CMyODListBox::OnLButtonDown(UINT nFlags, CPoint point)
{
   BOOL bOutside = TRUE;
   UINT uItem = ItemFromPoint(point, bOutside);

   if (!bOutside)
   {
      // Set the anchor to be the middle item.
      SetAnchorIndex(uItem);
      ASSERT((UINT)GetAnchorIndex() == uItem);
   }

   CListBox::OnLButtonDown(nFlags, point);
}


Header: afxwin.h

Community Additions

ADD
Show:
© 2014 Microsoft