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. Virtual List View

Virtual List View

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
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.
  • G Offline
    G Offline
    GameProfessor
    wrote on last edited by
    #1

    Each list view is associated with a list control which we can access by calling GetListCtrl(). How to set this list control to use LVS_OWNERDATA style ? I've tried to put these in OnCreate or OnInitialUpdate but it didn't work. The list is still not of OWNERDATA style. CListCtrl &ctlTmp = this->GetListCtrl(); ctlTmp.ModifyStyle(NULL, LVS_REPORT | LVS_OWNERDATA); how could I do this ?

    M 1 Reply Last reply
    0
    • G GameProfessor

      Each list view is associated with a list control which we can access by calling GetListCtrl(). How to set this list control to use LVS_OWNERDATA style ? I've tried to put these in OnCreate or OnInitialUpdate but it didn't work. The list is still not of OWNERDATA style. CListCtrl &ctlTmp = this->GetListCtrl(); ctlTmp.ModifyStyle(NULL, LVS_REPORT | LVS_OWNERDATA); how could I do this ?

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      You can't dynamically set this style - it has to be set when the control is created. You can pass it with the dwStyle parameter to Create()/CreateEx() or set it in the resource editor properties if it's a control on a dialog resource. Mark

      "Go that way, really fast. If something gets in your way, turn."

      G 1 Reply Last reply
      0
      • M Mark Salsbery

        You can't dynamically set this style - it has to be set when the control is created. You can pass it with the dwStyle parameter to Create()/CreateEx() or set it in the resource editor properties if it's a control on a dialog resource. Mark

        "Go that way, really fast. If something gets in your way, turn."

        G Offline
        G Offline
        GameProfessor
        wrote on last edited by
        #3

        Mark Salsbery wrote:

        You can pass it with the dwStyle parameter to Create()/CreateEx() or set it in the resource editor properties if it's a control on a dialog resource.

        yeah, if it was a list control in a normal dialog then it would be easy. But for a list view and its associated list control, I dont' know where and when the list control is created to set its style. GP

        M 1 Reply Last reply
        0
        • G GameProfessor

          Mark Salsbery wrote:

          You can pass it with the dwStyle parameter to Create()/CreateEx() or set it in the resource editor properties if it's a control on a dialog resource.

          yeah, if it was a list control in a normal dialog then it would be easy. But for a list view and its associated list control, I dont' know where and when the list control is created to set its style. GP

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          In a CListView derived class, override PreCreateWindow()...

          BOOL CMyListView::PreCreateWindow(CREATESTRUCT& cs)
          {
          if (CListView::PreCreateWindow(cs))
          {
          cs.style |= LVS_OWNERDATA;
          return TRUE;
          }

          return FALSE;
          }

          "Go that way, really fast. If something gets in your way, turn."

          G 1 Reply Last reply
          0
          • M Mark Salsbery

            In a CListView derived class, override PreCreateWindow()...

            BOOL CMyListView::PreCreateWindow(CREATESTRUCT& cs)
            {
            if (CListView::PreCreateWindow(cs))
            {
            cs.style |= LVS_OWNERDATA;
            return TRUE;
            }

            return FALSE;
            }

            "Go that way, really fast. If something gets in your way, turn."

            G Offline
            G Offline
            GameProfessor
            wrote on last edited by
            #5

            Thanks Mark, it works so charming now :-D I give u a 5-star vote :-D

            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