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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Too Stupid for CListCtrl

Too Stupid for CListCtrl

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

    Hallo, I`m trying to add an Item in a CListCtrl List, but it does not work:

    m\_lstAssignments.ModifyStyle(0,LVS\_REPORT|LVS\_LIST);
    
    m\_lstAssignments.InsertColumn(0, \_T("Description"), LVCFMT\_LEFT,-1);
    m\_lstAssignments.SetColumnWidth(0, LVSCW\_AUTOSIZE\_USEHEADER);
    
    m\_lstAssignments.InsertItem(0,"TEST");
    

    The List Control is just empty (no Header, no Items). What am I do wrong? Thank you!

    D 1 Reply Last reply
    0
    • J Joschwenk666

      Hallo, I`m trying to add an Item in a CListCtrl List, but it does not work:

      m\_lstAssignments.ModifyStyle(0,LVS\_REPORT|LVS\_LIST);
      
      m\_lstAssignments.InsertColumn(0, \_T("Description"), LVCFMT\_LEFT,-1);
      m\_lstAssignments.SetColumnWidth(0, LVSCW\_AUTOSIZE\_USEHEADER);
      
      m\_lstAssignments.InsertItem(0,"TEST");
      

      The List Control is just empty (no Header, no Items). What am I do wrong? Thank you!

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Joschwenk666 wrote:

      m_lstAssignments.ModifyStyle(0,LVS_REPORT|LVS_LIST);

      Pick one style or the other, not both?

      "One man's wage rise is another man's price increase." - Harold Wilson

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      "Man who follows car will be exhausted." - Confucius

      J 1 Reply Last reply
      0
      • D David Crow

        Joschwenk666 wrote:

        m_lstAssignments.ModifyStyle(0,LVS_REPORT|LVS_LIST);

        Pick one style or the other, not both?

        "One man's wage rise is another man's price increase." - Harold Wilson

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        "Man who follows car will be exhausted." - Confucius

        J Offline
        J Offline
        Joschwenk666
        wrote on last edited by
        #3

        I tried

        m_lstAssignments.ModifyStyle(0,LVS_REPORT);

        and

        m_lstAssignments.ModifyStyle(0,LVS_LIST);

        but nothing changes. Another Idea?

        D 1 Reply Last reply
        0
        • J Joschwenk666

          I tried

          m_lstAssignments.ModifyStyle(0,LVS_REPORT);

          and

          m_lstAssignments.ModifyStyle(0,LVS_LIST);

          but nothing changes. Another Idea?

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Joschwenk666 wrote:

          Another Idea?

          Have you tried:

          m_lstAssignments.InsertColumn(0, _T("Description"), LVCFMT_LEFT, 100);

          "One man's wage rise is another man's price increase." - Harold Wilson

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          "Man who follows car will be exhausted." - Confucius

          J 1 Reply Last reply
          0
          • D David Crow

            Joschwenk666 wrote:

            Another Idea?

            Have you tried:

            m_lstAssignments.InsertColumn(0, _T("Description"), LVCFMT_LEFT, 100);

            "One man's wage rise is another man's price increase." - Harold Wilson

            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

            "Man who follows car will be exhausted." - Confucius

            J Offline
            J Offline
            Joschwenk666
            wrote on last edited by
            #5

            Doesn`t work. My Code is now:

            m\_lstAssignments.ModifyStyle(0,LVS\_LIST);
            
            m\_lstAssignments.InsertColumn(0, \_T("Description"), LVCFMT\_LEFT, 100);
            m\_lstAssignments.InsertColumn(1, \_T("Column2"), LVCFMT\_LEFT, 100);
            m\_lstAssignments.InsertColumn(2, \_T("Column3"), LVCFMT\_LEFT, 100);
            m\_lstAssignments.SetColumnWidth(0, LVSCW\_AUTOSIZE\_USEHEADER);
            m\_lstAssignments.SetColumnWidth(1, LVSCW\_AUTOSIZE\_USEHEADER);
            m\_lstAssignments.SetColumnWidth(2, LVSCW\_AUTOSIZE\_USEHEADER);
            
            m\_lstAssignments.InsertItem(0,"TEST");
            

            Nothing happens, the List is just empty, no header columns, no items... Are there maybe propertys I have to set for my list in Resource Form View?

            D 1 Reply Last reply
            0
            • J Joschwenk666

              Doesn`t work. My Code is now:

              m\_lstAssignments.ModifyStyle(0,LVS\_LIST);
              
              m\_lstAssignments.InsertColumn(0, \_T("Description"), LVCFMT\_LEFT, 100);
              m\_lstAssignments.InsertColumn(1, \_T("Column2"), LVCFMT\_LEFT, 100);
              m\_lstAssignments.InsertColumn(2, \_T("Column3"), LVCFMT\_LEFT, 100);
              m\_lstAssignments.SetColumnWidth(0, LVSCW\_AUTOSIZE\_USEHEADER);
              m\_lstAssignments.SetColumnWidth(1, LVSCW\_AUTOSIZE\_USEHEADER);
              m\_lstAssignments.SetColumnWidth(2, LVSCW\_AUTOSIZE\_USEHEADER);
              
              m\_lstAssignments.InsertItem(0,"TEST");
              

              Nothing happens, the List is just empty, no header columns, no items... Are there maybe propertys I have to set for my list in Resource Form View?

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              Using the LVS_LIST style implies no columns.

              Joschwenk666 wrote:

              Are there maybe propertys I have to set for my list in Resource Form View?

              I just tried your code with the default settings and "TEST" indeed showed up.

              "One man's wage rise is another man's price increase." - Harold Wilson

              "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

              "Man who follows car will be exhausted." - Confucius

              J 1 Reply Last reply
              0
              • D David Crow

                Using the LVS_LIST style implies no columns.

                Joschwenk666 wrote:

                Are there maybe propertys I have to set for my list in Resource Form View?

                I just tried your code with the default settings and "TEST" indeed showed up.

                "One man's wage rise is another man's price increase." - Harold Wilson

                "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                "Man who follows car will be exhausted." - Confucius

                J Offline
                J Offline
                Joschwenk666
                wrote on last edited by
                #7

                Oh, I`m really stupid: I put a Listbox Control on my form, not a List Control Control.... Tank you for your effords.

                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