When deleting an item, remove selection, don't add it!

This commit is contained in:
Dimitrie O. Paun 2002-10-19 00:59:34 +00:00 committed by Alexandre Julliard
parent 7521a42ed3
commit 0dbab63fa6
1 changed files with 5 additions and 12 deletions

View File

@ -4032,23 +4032,16 @@ static LRESULT LISTVIEW_DeleteItem(LISTVIEW_INFO *infoPtr, INT nItem)
TRACE("(nItem=%d)\n", nItem); TRACE("(nItem=%d)\n", nItem);
/* remove selection, and focus */
item.state = 0;
item.stateMask = LVIS_SELECTED | LVIS_FOCUSED;
LISTVIEW_SetItemState(infoPtr, nItem, &item);
/* First, send LVN_DELETEITEM notification. */ /* send LVN_DELETEITEM notification. */
ZeroMemory(&nmlv, sizeof (NMLISTVIEW)); ZeroMemory(&nmlv, sizeof (NMLISTVIEW));
nmlv.iItem = nItem; nmlv.iItem = nItem;
notify_listview(infoPtr, LVN_DELETEITEM, &nmlv); notify_listview(infoPtr, LVN_DELETEITEM, &nmlv);
if (nItem == infoPtr->nFocusedItem)
{
infoPtr->nFocusedItem = -1;
SetRectEmpty(&infoPtr->rcFocus);
}
/* remove it from the selection range */
item.state = LVIS_SELECTED;
item.stateMask = LVIS_SELECTED;
LISTVIEW_SetItemState(infoPtr,nItem,&item);
if (lStyle & LVS_OWNERDATA) if (lStyle & LVS_OWNERDATA)
{ {
infoPtr->nItemCount--; infoPtr->nItemCount--;