Hi everyone.
I know long time no see, but i have been busy :)

I am facing a strange problem with ListView control. I do InsertItem but the string is not shown in the listview??? Even when i do GetItemCount on the ListView after adding the item , it correctly shows me 1, but the string is still not shown? I am posting the code here. Sorry for it being in C, but i believe noone should have problems understanding it.

DWORD dwStyle=WS_POPUP|WS_DLGFRAME | LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_SINGLESEL |

LVS_SHAREIMAGELISTS | LVS_SHOWSELALWAYS |LVS_SORTASCENDING|WS_VISIBLE;

//creates the window
m_cdhWnd = CreateWindow( WC_LISTVIEW, NULL, dwStyle,
rect.left, rect.top,rect.right-rect.left, rect.bottom-rect.top,
m_hWndEdit, NULL, m_pApp->GetHINSTANCE(), NULL );

ASSERT(IsWindow(m_cdhWnd));

LV_ITEM lvi ={0};

lvi.mask=LVIF_TEXT;
lvi.pszText="teststring";
ListView_InsertItem(m_cdhWnd, &lvi);

ListView_SetColumnWidth(m_cdhWnd,0,LVSCW_AUTOSIZE );
int i = ListView_GetItemCount(m_cdhWnd);
Posted on 2001-12-04 04:42:30 by MovingFulcrum
Although you used LVS_NOCOLUMNHEADER in the listview style, you still need to have at least one column. It will not show that column, but it is required to show items.

Thomas
Posted on 2001-12-04 06:05:02 by Thomas
Thanks a lot Thomas. And silly, silly me. I had been sitting on that for hours, checked each and every window style and almost each line of code concerning it. Next time i will try to be more careful:)

Hiro,if you feel you can delete this post. Way too silly to stay here:)

Btw, Thomas, That wizard of yours looks pretty angry;)
Posted on 2001-12-04 09:30:14 by MovingFulcrum
It's not too silly MF... if people knew how to search, a post like this
could keep the same question from being asked twice =).
Posted on 2001-12-04 10:22:47 by f0dder