CListBox::SetAnchorIndex

voidSetAnchorIndex(intnIndex**);**

Parameters

nIndex

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

Remarks

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

Example

// The pointer to my list box.
extern CListBox* pmyListBox;
// Point where mouse was clicked.
extern CPoint myPoint;

BOOL bOutside;
UINT uItem = pmyListBox->ItemFromPoint(myPoint, bOutside);

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

CListBox OverviewClass MembersHierarchy Chart

See Also   CListBox::GetAnchorIndex