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. CListCtrl SetItem

CListCtrl SetItem

Scheduled Pinned Locked Moved C / C++ / MFC
help
5 Posts 3 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.
  • N Offline
    N Offline
    Naveen
    wrote on last edited by
    #1

    hi, I have set the image for a subitem as follows LVITEM litem; litem.mask = LVIF_IMAGE; litem.iSubItem = 1; litem.iItem = 0; litem.iImage = 0; m_List.SetItem( &litem ); but when I try to call the GetItem to get the image associated with a subitem, its not working(it is working if the subitem is 0). I have set the LVS_EX_SUBITEMIMAGES style of the list control. What else should I do.. Please help me nave

    H 1 Reply Last reply
    0
    • N Naveen

      hi, I have set the image for a subitem as follows LVITEM litem; litem.mask = LVIF_IMAGE; litem.iSubItem = 1; litem.iItem = 0; litem.iImage = 0; m_List.SetItem( &litem ); but when I try to call the GetItem to get the image associated with a subitem, its not working(it is working if the subitem is 0). I have set the LVS_EX_SUBITEMIMAGES style of the list control. What else should I do.. Please help me nave

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #2

      maybe it is some helpful to you IMAGEINFO ImageInfo; CImageList* m_pImageList = GetImageList(LVSIL_NORMAL); m_pImageList->GetImageInfo(nImage, &ImageInfo);

      N 1 Reply Last reply
      0
      • H Hamid Taebi

        maybe it is some helpful to you IMAGEINFO ImageInfo; CImageList* m_pImageList = GetImageList(LVSIL_NORMAL); m_pImageList->GetImageInfo(nImage, &ImageInfo);

        N Offline
        N Offline
        Naveen
        wrote on last edited by
        #3

        Thanks, But What i want to know is the image number associated with a subitem in listctrl. I think the above function won't help me in that.. nave

        H M 2 Replies Last reply
        0
        • N Naveen

          Thanks, But What i want to know is the image number associated with a subitem in listctrl. I think the above function won't help me in that.. nave

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          Naveen R , I have this problem(But I have derived CListCtrl and I use this way in the NM_CUSTOMDRAW) anyway I think you can use int nImage=GetNextItem(-1,LVNI_SELECTED);

          1 Reply Last reply
          0
          • N Naveen

            Thanks, But What i want to know is the image number associated with a subitem in listctrl. I think the above function won't help me in that.. nave

            M Offline
            M Offline
            Mike ONeill
            wrote on last edited by
            #5

            I don't think that you can get the index for a sub-item image, since the iImage member of LVITEM structure is specifically described as the index of the item's image, and not the index of the sub-item's image. Maybe you must manually store the sub-item's image index in the lParam of the item and retrieve it from there. Best, Mike

            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