CListView problems...
-
I'm trying to create a view class derived from CListView. It is created as the main view object of an MDI application, by the appwizard on project creation. OnInitialUpdate() is where you place the code that initializes a view. My problem is that I can't seem to get the CListView to show the column headers. Can anyone see what I'm doing wrong? (Here's my OnInitialUpdate:) void CMailBoxProtoView::OnInitialUpdate() { CListView::OnInitialUpdate(); int x; // Get a reference to the list view's control CListCtrl& listCtrl = this->GetListCtrl(); // Add the columns listCtrl.InsertColumn(0, _T("From"), LVCFMT_LEFT); listCtrl.InsertColumn(1, _T("Received"), LVCFMT_LEFT); listCtrl.InsertColumn(2, _T("Subject"), LVCFMT_LEFT); listCtrl.InsertColumn(3, _T("Size"), LVCFMT_LEFT); // Set the column sizes for(x = 0; x < 4; x++) listCtrl.SetColumnWidth(x, LVSCW_AUTOSIZE_USEHEADER); // Set the style of the list control listCtrl.SetExtendedStyle(LVS_REPORT); // This displays fine, but where's the headings?! listCtrl.InsertItem(0, "Item0"); } Many thanx, funbag! skydiving....if at first you don't succeed, you're fecked!
-
I'm trying to create a view class derived from CListView. It is created as the main view object of an MDI application, by the appwizard on project creation. OnInitialUpdate() is where you place the code that initializes a view. My problem is that I can't seem to get the CListView to show the column headers. Can anyone see what I'm doing wrong? (Here's my OnInitialUpdate:) void CMailBoxProtoView::OnInitialUpdate() { CListView::OnInitialUpdate(); int x; // Get a reference to the list view's control CListCtrl& listCtrl = this->GetListCtrl(); // Add the columns listCtrl.InsertColumn(0, _T("From"), LVCFMT_LEFT); listCtrl.InsertColumn(1, _T("Received"), LVCFMT_LEFT); listCtrl.InsertColumn(2, _T("Subject"), LVCFMT_LEFT); listCtrl.InsertColumn(3, _T("Size"), LVCFMT_LEFT); // Set the column sizes for(x = 0; x < 4; x++) listCtrl.SetColumnWidth(x, LVSCW_AUTOSIZE_USEHEADER); // Set the style of the list control listCtrl.SetExtendedStyle(LVS_REPORT); // This displays fine, but where's the headings?! listCtrl.InsertItem(0, "Item0"); } Many thanx, funbag! skydiving....if at first you don't succeed, you're fecked!
-
I test your code and it's ok,problem is not here. Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975 -
that's really strange! I can't seem to get it going at all. You think maybe there might be a message I'm not mapping or something??? skydiving....if at first you don't succeed, you're fecked!
overriden
OnCreate
of your view class and change it to this:int CYourView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
lpCreateStruct->style |= LVS_REPORT;
if (CListView::OnCreate(lpCreateStruct) == -1)
return -1;return 0;
}
Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975 -
overriden
OnCreate
of your view class and change it to this:int CYourView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
lpCreateStruct->style |= LVS_REPORT;
if (CListView::OnCreate(lpCreateStruct) == -1)
return -1;return 0;
}
Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975