NM_CUSTOMDRAW (ListView)
-
Hi, I have a couple of list views in which I use Custom Draw to get my content on screen. This all works just fine, except for one thing. The uItemState member of the NMCUSTOMDRAW structure is supposed to indicate whether an item is selected or not. I would test it like:
if( pNMCD->nmcd.uItemState & CDIS_SELECTED)
{
// ...
}Except that always ends up being true, even when an item is not selected. So, right now I'm testing the MFC way with GetItemState, and test for the LVIS_SELECTED bit. But am I just using uItemState in a wrong way or anything? Everywhere I look at on the web it's used in such way.. It's not a big thing, I mean, GetItemState does the job. But I am getting curious why it won't work for me.
-
Hi, I have a couple of list views in which I use Custom Draw to get my content on screen. This all works just fine, except for one thing. The uItemState member of the NMCUSTOMDRAW structure is supposed to indicate whether an item is selected or not. I would test it like:
if( pNMCD->nmcd.uItemState & CDIS_SELECTED)
{
// ...
}Except that always ends up being true, even when an item is not selected. So, right now I'm testing the MFC way with GetItemState, and test for the LVIS_SELECTED bit. But am I just using uItemState in a wrong way or anything? Everywhere I look at on the web it's used in such way.. It's not a big thing, I mean, GetItemState does the job. But I am getting curious why it won't work for me.
uItemState
is only valid for certain draw stages, as specified by theuDrawStage
member ofNMCUSTOMDRAW
.
Software Zen:
delete this;