Items not visible in ActiveX ListCtrl
-
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 !
-
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 !
thammadi wrote:
cs.style |= LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_OWNERDRAWFIXED;
if you specify
LVS_OWNERDRAWFIXED
, you have to handle theDrawItem()
function. In your case since your not handling the owner draw, remove theLVS_OWNERDRAWFIXED
style.nave [OpenedFileFinder]
-
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 !
Whats the return value of ListView_InsertColumn and can you see items if you remove LVS_OWNERDRAWFIXED?
-
thammadi wrote:
cs.style |= LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_OWNERDRAWFIXED;
if you specify
LVS_OWNERDRAWFIXED
, you have to handle theDrawItem()
function. In your case since your not handling the owner draw, remove theLVS_OWNERDRAWFIXED
style.nave [OpenedFileFinder]
-
Whats the return value of ListView_InsertColumn and can you see items if you remove LVS_OWNERDRAWFIXED?
-
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 !
I got this working ! mistake was, I did not use
memset(&lvItem,0,sizeof(LVITEM));
in the below code snippetLVITEM 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