Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. NM_CUSTOMDRAW (ListView)

NM_CUSTOMDRAW (ListView)

Scheduled Pinned Locked Moved C / C++ / MFC
c++testingbeta-testingquestioncareer
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Maarten Kools
    wrote on last edited by
    #1

    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.

    G 1 Reply Last reply
    0
    • M Maarten Kools

      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.

      G Offline
      G Offline
      Gary R Wheeler
      wrote on last edited by
      #2

      uItemState is only valid for certain draw stages, as specified by the uDrawStage member of NMCUSTOMDRAW.


      Software Zen: delete this;

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups