|
-
March 31st, 2005, 03:43 PM
#1
CListCtrl Notification Behavior
Hi,
Please bear with me as I describe this problem. I have already scoured the forum for an already existing answer to this but have found nothing that has provided a solution.
I have a CListCtrl object that has several operation entries. Some of these, when selected, bring up a dialog box for the user to set properties for the selected operation. When the box comes up, the user may decide to click Cancel and not set any properties at which point I deselect the item in the operations list.
The problem I'm having is that when I deselect the item, it seems an extra notification is being sent and the flags show that the item IS selected when it should not be and so this is causing my logic to redisplay the dialog thinking the item is selected.
Here's some code. First is where I'm handling the changes:
Code:
void CRovRebuildView::OnItemchangedListOperations(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
CheckList(pNMHDR, pResult);
*pResult = 0;
}
in CheckList, everything works fine until I call
Code:
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
UINT uNewState = pNMListView->uNewState;
UINT uOldState = pNMListView->uOldState;
int iIndex = pNMListView->iItem;
...
m_listOperations.SetItemState(iIndex, 0, LVIS_SELECTED);
which causes the notification to call OnItemchangedListOperations again with the flags that show the item is selected. Even GetFirstSelectedItemPosition() shows the item is still selected. But once it goes through the 2nd iteration, then the flags are set correctly.
Either I'm missing something or there doesn't seem to be a way check precisely what's checked and what isn't.
Can anyone shed some light on the subject please? Please let me know if you need more info on this from me.
Arthur
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|