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. CListView problems...

CListView problems...

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
5 Posts 2 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.
  • F Offline
    F Offline
    funbag
    wrote on last edited by
    #1

    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!

    M 1 Reply Last reply
    0
    • F funbag

      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!

      M Offline
      M Offline
      Mazdak
      wrote on last edited by
      #2

      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

      F 1 Reply Last reply
      0
      • M Mazdak

        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

        F Offline
        F Offline
        funbag
        wrote on last edited by
        #3

        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!

        M 1 Reply Last reply
        0
        • F funbag

          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!

          M Offline
          M Offline
          Mazdak
          wrote on last edited by
          #4

          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

          F 1 Reply Last reply
          0
          • M Mazdak

            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

            F Offline
            F Offline
            funbag
            wrote on last edited by
            #5

            Thank you thank you thank you thank you thank you (and I didn't use copy and paste there either!) It works great! Thank you! skydiving....if at first you don't succeed, you're fecked!

            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