openGL
asked on
Nothing showing in CListView
Ok, I have a view in my application which is derived from CListView. Unfortunetly, when I add items to the view, nothing shows up. The client area remains blank, although resizing the window make scroll bars appear which make it seem like the items are there. In any case, here is the pertinent code:
/* here is the creation handler...it should be in report view with no column headers */
BOOL CMessageView::Create(LPCTS TR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
dwStyle |= LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_SINGLESEL;
return CWnd::Create(lpszClassName , lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
}
/*here is the code which inserts an item into the view */
/*my purpose here is to insert the item as the last thing in the control, then scroll down to make sure it can be seen */
void CMessageView::PostMessage( CString str, BOOL mode)
{
CListCtrl &ctrl = GetListCtrl();
if (mode == TRUE)
{
ctrl.InsertItem(ctrl.GetIt emCount(), str.GetBuffer(500));
ctrl.InsertItem(ctrl.GetIt emCount(), "-");
ctrl.EnsureVisible(ctrl.Ge tItemCount (), FALSE);
}
else
{
ctrl.InsertItem(ctrl.GetIt emCount(), str.GetBuffer(500));
ctrl.EnsureVisible(ctrl.Ge tItemCount (), FALSE);
}
}
so there it is...very simple. I thought I'd like to at least get the text going before I added a CImageList to it. Anyone have any idea why it isn't drawing?
/* here is the creation handler...it should be in report view with no column headers */
BOOL CMessageView::Create(LPCTS
{
dwStyle |= LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_SINGLESEL;
return CWnd::Create(lpszClassName
}
/*here is the code which inserts an item into the view */
/*my purpose here is to insert the item as the last thing in the control, then scroll down to make sure it can be seen */
void CMessageView::PostMessage(
{
CListCtrl &ctrl = GetListCtrl();
if (mode == TRUE)
{
ctrl.InsertItem(ctrl.GetIt
ctrl.InsertItem(ctrl.GetIt
ctrl.EnsureVisible(ctrl.Ge
}
else
{
ctrl.InsertItem(ctrl.GetIt
ctrl.EnsureVisible(ctrl.Ge
}
}
so there it is...very simple. I thought I'd like to at least get the text going before I added a CImageList to it. Anyone have any idea why it isn't drawing?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.