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. Items not visible in ActiveX ListCtrl

Items not visible in ActiveX ListCtrl

Scheduled Pinned Locked Moved C / C++ / MFC
helpcssvisual-studiocom
6 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.
  • T Offline
    T Offline
    thammadi
    wrote on last edited by
    #1

    Hi All, I have an activex control subclassed from SysListView32. I wanted it to appear and work like the property grid the we see in VS 2003/2005. I was able to get the look right. The problem is even though I added items using ListView_InsertItem, these items are not visible on the list control. In PreCreateWindow, I am setting the style like this: cs.style |= LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_OWNERDRAWFIXED; In OnCreate, I am adding the columns and a single item like this: ListView_InsertColumn(m_hWnd, 0, "Empty"); ListView_InsertColumn(m_hWnd, 1, "Property Name"); ListView_InsertColumn(m_hWnd, 2, "Property Value"); LVITEM lvItem; lvItem.mask = LVIF_TEXT | LVIF_PARAM; lvItem.iItem = 0; lvItem.pszText = ""; ListView_InsertItem(m_hWnd, &lvItem); ListView_SetItemText(m_hWnd, 0, 1, "Properties") I also used OnCustomDraw, OnEraseBkgnd & MeasureItem methods to archive my look and feel. Please help !

    N H T 3 Replies Last reply
    0
    • T thammadi

      Hi All, I have an activex control subclassed from SysListView32. I wanted it to appear and work like the property grid the we see in VS 2003/2005. I was able to get the look right. The problem is even though I added items using ListView_InsertItem, these items are not visible on the list control. In PreCreateWindow, I am setting the style like this: cs.style |= LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_OWNERDRAWFIXED; In OnCreate, I am adding the columns and a single item like this: ListView_InsertColumn(m_hWnd, 0, "Empty"); ListView_InsertColumn(m_hWnd, 1, "Property Name"); ListView_InsertColumn(m_hWnd, 2, "Property Value"); LVITEM lvItem; lvItem.mask = LVIF_TEXT | LVIF_PARAM; lvItem.iItem = 0; lvItem.pszText = ""; ListView_InsertItem(m_hWnd, &lvItem); ListView_SetItemText(m_hWnd, 0, 1, "Properties") I also used OnCustomDraw, OnEraseBkgnd & MeasureItem methods to archive my look and feel. Please help !

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

      thammadi wrote:

      cs.style |= LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_OWNERDRAWFIXED;

      if you specify LVS_OWNERDRAWFIXED, you have to handle the DrawItem() function. In your case since your not handling the owner draw, remove the LVS_OWNERDRAWFIXED style.

      nave [OpenedFileFinder]

      T 1 Reply Last reply
      0
      • T thammadi

        Hi All, I have an activex control subclassed from SysListView32. I wanted it to appear and work like the property grid the we see in VS 2003/2005. I was able to get the look right. The problem is even though I added items using ListView_InsertItem, these items are not visible on the list control. In PreCreateWindow, I am setting the style like this: cs.style |= LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_OWNERDRAWFIXED; In OnCreate, I am adding the columns and a single item like this: ListView_InsertColumn(m_hWnd, 0, "Empty"); ListView_InsertColumn(m_hWnd, 1, "Property Name"); ListView_InsertColumn(m_hWnd, 2, "Property Value"); LVITEM lvItem; lvItem.mask = LVIF_TEXT | LVIF_PARAM; lvItem.iItem = 0; lvItem.pszText = ""; ListView_InsertItem(m_hWnd, &lvItem); ListView_SetItemText(m_hWnd, 0, 1, "Properties") I also used OnCustomDraw, OnEraseBkgnd & MeasureItem methods to archive my look and feel. Please help !

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

        Whats the return value of ListView_InsertColumn and can you see items if you remove LVS_OWNERDRAWFIXED?

        T 1 Reply Last reply
        0
        • N Naveen

          thammadi wrote:

          cs.style |= LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_OWNERDRAWFIXED;

          if you specify LVS_OWNERDRAWFIXED, you have to handle the DrawItem() function. In your case since your not handling the owner draw, remove the LVS_OWNERDRAWFIXED style.

          nave [OpenedFileFinder]

          T Offline
          T Offline
          thammadi
          wrote on last edited by
          #4

          I removed LVS_OWNERDRAWFIXED, even then the inserted item is not visible.

          1 Reply Last reply
          0
          • H Hamid Taebi

            Whats the return value of ListView_InsertColumn and can you see items if you remove LVS_OWNERDRAWFIXED?

            T Offline
            T Offline
            thammadi
            wrote on last edited by
            #5

            removed LVS_OWNERDRAWFIXED, items still not visible.

            1 Reply Last reply
            0
            • T thammadi

              Hi All, I have an activex control subclassed from SysListView32. I wanted it to appear and work like the property grid the we see in VS 2003/2005. I was able to get the look right. The problem is even though I added items using ListView_InsertItem, these items are not visible on the list control. In PreCreateWindow, I am setting the style like this: cs.style |= LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_OWNERDRAWFIXED; In OnCreate, I am adding the columns and a single item like this: ListView_InsertColumn(m_hWnd, 0, "Empty"); ListView_InsertColumn(m_hWnd, 1, "Property Name"); ListView_InsertColumn(m_hWnd, 2, "Property Value"); LVITEM lvItem; lvItem.mask = LVIF_TEXT | LVIF_PARAM; lvItem.iItem = 0; lvItem.pszText = ""; ListView_InsertItem(m_hWnd, &lvItem); ListView_SetItemText(m_hWnd, 0, 1, "Properties") I also used OnCustomDraw, OnEraseBkgnd & MeasureItem methods to archive my look and feel. Please help !

              T Offline
              T Offline
              thammadi
              wrote on last edited by
              #6

              I got this working ! mistake was, I did not use memset(&lvItem,0,sizeof(LVITEM)); in the below code snippet LVITEM lvItem; lvItem.mask = LVIF_TEXT | LVIF_PARAM; lvItem.iItem = 0; lvItem.pszText = ""; ListView_InsertItem(m_hWnd, &lvItem); ListView_SetItemText(m_hWnd, 0, 1, "Properties") :-D

              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