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. CListCtrl problem

CListCtrl problem

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

    Dear All, I want to display items in a CListCtrl but by default the Horizontal scroll bar is appearing if I add more items in the list. But I need to display only Vertical bars if I add more items. I use like below : <pre> m_List.EnableScrollBar(SB_VERT, true); m_List.EnableScrollBar(SB_HORZ,false); The above works only if the list is having minimum items, when it exceeds the client area then only Horizontal bar is working and Vertical bar is shown but not working.

    CPalliniC 1 Reply Last reply
    0
    • B bhanu_8509

      Dear All, I want to display items in a CListCtrl but by default the Horizontal scroll bar is appearing if I add more items in the list. But I need to display only Vertical bars if I add more items. I use like below : <pre> m_List.EnableScrollBar(SB_VERT, true); m_List.EnableScrollBar(SB_HORZ,false); The above works only if the list is having minimum items, when it exceeds the client area then only Horizontal bar is working and Vertical bar is shown but not working.

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      Possibly you need to use the LVS_REPORT style. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      In testa che avete, signor di Ceprano?

      B 1 Reply Last reply
      0
      • CPalliniC CPallini

        Possibly you need to use the LVS_REPORT style. :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        B Offline
        B Offline
        bhanu_8509
        wrote on last edited by
        #3

        When I use Report Style, even I cannot add the items in the list.

        //List Control parameters
        //CONTROL "",IDC_LIST1,"SysListView32",LVS_LIST | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,112,23,84,114 (even I tried LVS_REPORT)
        m_List.EnableScrollBar(SB_VERT, true);
        m_List.EnableScrollBar(SB_HORZ,false);
        CString strText;
        int nColumnCount = 0;
        for (int i=0;i < 20;i++)
        {
        strText.Format(TEXT("item %d"), i);
        // Insert the item
        m_List.InsertItem(i, strText);
        }

        CPalliniC 1 Reply Last reply
        0
        • B bhanu_8509

          When I use Report Style, even I cannot add the items in the list.

          //List Control parameters
          //CONTROL "",IDC_LIST1,"SysListView32",LVS_LIST | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,112,23,84,114 (even I tried LVS_REPORT)
          m_List.EnableScrollBar(SB_VERT, true);
          m_List.EnableScrollBar(SB_HORZ,false);
          CString strText;
          int nColumnCount = 0;
          for (int i=0;i < 20;i++)
          {
          strText.Format(TEXT("item %d"), i);
          // Insert the item
          m_List.InsertItem(i, strText);
          }

          CPalliniC Offline
          CPalliniC Offline
          CPallini
          wrote on last edited by
          #4

          bhanu_8509 wrote:

          m_List.EnableScrollBar(SB_VERT, true); m_List.EnableScrollBar(SB_HORZ,false);

          You don't need the above lines.

          bhanu_8509 wrote:

          When I use Report Style, even I cannot add the items in the list

          What does it mean? :confused: :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [My articles]

          In testa che avete, signor di Ceprano?

          B 1 Reply Last reply
          0
          • CPalliniC CPallini

            bhanu_8509 wrote:

            m_List.EnableScrollBar(SB_VERT, true); m_List.EnableScrollBar(SB_HORZ,false);

            You don't need the above lines.

            bhanu_8509 wrote:

            When I use Report Style, even I cannot add the items in the list

            What does it mean? :confused: :)

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
            [My articles]

            B Offline
            B Offline
            bhanu_8509
            wrote on last edited by
            #5

            When I use the CListCtrl using LVS_REPORT, I cannot populate the list with the items.

            CString strText;
            int nColumnCount = 0;
            for (int i=0;i < 20;i++)
            {
            strText.Format(TEXT("item %d"), i);
            // Insert the item, select every other item.
            m_List.InsertItem(i, strText);
            }

            B 2 Replies Last reply
            0
            • B bhanu_8509

              When I use the CListCtrl using LVS_REPORT, I cannot populate the list with the items.

              CString strText;
              int nColumnCount = 0;
              for (int i=0;i < 20;i++)
              {
              strText.Format(TEXT("item %d"), i);
              // Insert the item, select every other item.
              m_List.InsertItem(i, strText);
              }

              B Offline
              B Offline
              bhanu_8509
              wrote on last edited by
              #6

              I am sorry, I forget to Insert the column. Now I changed it and it is working fine. Thanks for your help.

              1 Reply Last reply
              0
              • B bhanu_8509

                When I use the CListCtrl using LVS_REPORT, I cannot populate the list with the items.

                CString strText;
                int nColumnCount = 0;
                for (int i=0;i < 20;i++)
                {
                strText.Format(TEXT("item %d"), i);
                // Insert the item, select every other item.
                m_List.InsertItem(i, strText);
                }

                B Offline
                B Offline
                bhanu_8509
                wrote on last edited by
                #7

                I am sorry, I forget to Insert the column. Now I changed it and it is working fine. Thanks for your help. Topic closed...

                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