Share via


CComboBox::DeleteItem

Called by the framework when the user deletes an item from an owner-draw CComboBox object or destroys the combo box.

virtual void DeleteItem( 
   LPDELETEITEMSTRUCT lpDeleteItemStruct  
);

Parameters

  • lpDeleteItemStruct
    A long pointer to a Windows DELETEITEMSTRUCT structure that contains information about the deleted item. See CWnd::OnDeleteItem for a description of this structure.

Remarks

The default implementation of this function does nothing. Override this function to redraw the combo box as needed.

Example

// CMyComboBox is my owner-drawn combo box derived from CComboBox. This  
// example simply dumps the item's text. The combo box control was  
// created with the following code: 
//   pmyComboBox->Create( 
//      WS_CHILD|WS_VISIBLE|WS_BORDER|WS_HSCROLL|WS_VSCROLL| 
//      CBS_SORT|CBS_OWNERDRAWVARIABLE, 
//      myRect, pParentWnd, 1); 
// 
void CMyComboBox::DeleteItem(LPDELETEITEMSTRUCT lpDeleteItemStruct) 
{
   ASSERT(lpDeleteItemStruct->CtlType == ODT_COMBOBOX);
   LPTSTR lpszText = (LPTSTR) lpDeleteItemStruct->itemData;
   ASSERT(lpszText != NULL);

   AFXDUMP(lpszText);
}

Requirements

Header: afxwin.h

See Also

Reference

CComboBox Class

Hierarchy Chart

CComboBox::CompareItem

CComboBox::DrawItem

CComboBox::MeasureItem

WM_DELETEITEM