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. CListBox scrollbar problem

CListBox scrollbar problem

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
6 Posts 4 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.
  • M Offline
    M Offline
    moobob
    wrote on last edited by
    #1

    I'm having a problem making the horizontal scrollbars appear in a list box in my application. I created it with the dialog editor and have the horizontal & vertical scrollbar boxes checked on the properties dialog. The vertical scrollbar does appear when the enough items are placed in the box. However, the horizontal never appears. i've tried moving controls around to insure their is room for the scroll bars to appear. I've compared the properties to another list box in the application which does display the horiz scroll bars when necessary. Are there any situations that anyone knows which would cause the scroll bars not to appear in a CListBox? Thanks in advance, Bob

    T R 2 Replies Last reply
    0
    • M moobob

      I'm having a problem making the horizontal scrollbars appear in a list box in my application. I created it with the dialog editor and have the horizontal & vertical scrollbar boxes checked on the properties dialog. The vertical scrollbar does appear when the enough items are placed in the box. However, the horizontal never appears. i've tried moving controls around to insure their is room for the scroll bars to appear. I've compared the properties to another list box in the application which does display the horiz scroll bars when necessary. Are there any situations that anyone knows which would cause the scroll bars not to appear in a CListBox? Thanks in advance, Bob

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      AFAIR, horizontal scrollbars work only with multi-column listbox. If you want to scroll your items horizontally and you have only one column, consider switching to listview control. Tomasz Sowinski -- http://www.shooltz.com

      What is "scratch" and why can everything be made from it?

      1 Reply Last reply
      0
      • M moobob

        I'm having a problem making the horizontal scrollbars appear in a list box in my application. I created it with the dialog editor and have the horizontal & vertical scrollbar boxes checked on the properties dialog. The vertical scrollbar does appear when the enough items are placed in the box. However, the horizontal never appears. i've tried moving controls around to insure their is room for the scroll bars to appear. I've compared the properties to another list box in the application which does display the horiz scroll bars when necessary. Are there any situations that anyone knows which would cause the scroll bars not to appear in a CListBox? Thanks in advance, Bob

        R Offline
        R Offline
        Ravi Bhavnani
        wrote on last edited by
        #3

        You need to call CListBox::SetHorizontalExtent(). The value passed in the arg will cause the horizontal scrollbar to appear if it's more than the current width of the scrollbar. It's nicer to subclass CListBox and override AddItem(), InsertItem() and DeleteItem() so that they recompute the current max length of the list box's strings and call SetHorizontalExtent()themselves. /ravi Let's put "civil" back into "civilization" http://www.ravib.com ravib@ravib.com

        M M 2 Replies Last reply
        0
        • R Ravi Bhavnani

          You need to call CListBox::SetHorizontalExtent(). The value passed in the arg will cause the horizontal scrollbar to appear if it's more than the current width of the scrollbar. It's nicer to subclass CListBox and override AddItem(), InsertItem() and DeleteItem() so that they recompute the current max length of the list box's strings and call SetHorizontalExtent()themselves. /ravi Let's put "civil" back into "civilization" http://www.ravib.com ravib@ravib.com

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

          Thanks! that did the trick. Bob

          R 1 Reply Last reply
          0
          • M moobob

            Thanks! that did the trick. Bob

            R Offline
            R Offline
            Ravi Bhavnani
            wrote on last edited by
            #5

            Bob, this[^] is what you should be using! /ravi Let's put "civil" back into "civilization" http://www.ravib.com ravib@ravib.com

            1 Reply Last reply
            0
            • R Ravi Bhavnani

              You need to call CListBox::SetHorizontalExtent(). The value passed in the arg will cause the horizontal scrollbar to appear if it's more than the current width of the scrollbar. It's nicer to subclass CListBox and override AddItem(), InsertItem() and DeleteItem() so that they recompute the current max length of the list box's strings and call SetHorizontalExtent()themselves. /ravi Let's put "civil" back into "civilization" http://www.ravib.com ravib@ravib.com

              M Offline
              M Offline
              Mushtaque Nizamani
              wrote on last edited by
              #6

              Ravi Bhavnani wrote:

              You need to call CListBox::SetHorizontalExtent(). The value passed in the arg will cause the horizontal scrollbar to appear if it's more than the current width of the scrollbar.

              Thanks for that, i have resolved one of my problem.

              Best Regards, Mushq Mushtaque Ahmed Nizamani Software Engineer Ultimus Pakistan "English is my second language; please excuse any grammatical or spelling mistakes"

              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