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. CComboBox height

CComboBox height

Scheduled Pinned Locked Moved C / C++ / MFC
c++designjsonhelptutorial
3 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.
  • D Offline
    D Offline
    Demian Panello
    wrote on last edited by
    #1

    Hi. I'm writing an application that it create a CComboBox at runtime like this: rcControl.left = long(rcClient.Width() * 0.05); rcControl.top = long(rcClient.Height() * 0.10); rcControl.right = rcControl.left + long(rcClient.Width() * 0.90) ; rcControl.bottom = rcControl.top +long(rcClient.Height() * 0.40); m_cboParam.Create(CBS_DROPDOWNLIST|LBS_STANDARD|CBS_SORT|WS_CHILD|WS_VISIBLE, rcControl, this, IDC_PARAM); .... It works, but the problem is that I want to show more items when the user pull the list down. At the moment it shows just two items and I must scroll the list down to see the rest of them. How could I set, maybe the heigth or something else, so it will be able to show more than two items.?? (at least 4 or 5). Setting the amount of items to show in a combobox at design time is easy:->, just clicking over the arrow and then stretch it to the desire height. But how could I set that at runtime??:doh: Thank you.

    Demian. "I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone." -Bjarne Stroustrup, computer science professor, designer of C++ programming language (1950- )

    D P 2 Replies Last reply
    0
    • D Demian Panello

      Hi. I'm writing an application that it create a CComboBox at runtime like this: rcControl.left = long(rcClient.Width() * 0.05); rcControl.top = long(rcClient.Height() * 0.10); rcControl.right = rcControl.left + long(rcClient.Width() * 0.90) ; rcControl.bottom = rcControl.top +long(rcClient.Height() * 0.40); m_cboParam.Create(CBS_DROPDOWNLIST|LBS_STANDARD|CBS_SORT|WS_CHILD|WS_VISIBLE, rcControl, this, IDC_PARAM); .... It works, but the problem is that I want to show more items when the user pull the list down. At the moment it shows just two items and I must scroll the list down to see the rest of them. How could I set, maybe the heigth or something else, so it will be able to show more than two items.?? (at least 4 or 5). Setting the amount of items to show in a combobox at design time is easy:->, just clicking over the arrow and then stretch it to the desire height. But how could I set that at runtime??:doh: Thank you.

      Demian. "I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone." -Bjarne Stroustrup, computer science professor, designer of C++ programming language (1950- )

      D Offline
      D Offline
      Demian Panello
      wrote on last edited by
      #2

      Forget it.;P Solved. I had just to adjust the height in other function when the controls reposition. :rolleyes: Thank you.

      Demian. "I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone." -Bjarne Stroustrup, computer science professor, designer of C++ programming language (1950- )

      1 Reply Last reply
      0
      • D Demian Panello

        Hi. I'm writing an application that it create a CComboBox at runtime like this: rcControl.left = long(rcClient.Width() * 0.05); rcControl.top = long(rcClient.Height() * 0.10); rcControl.right = rcControl.left + long(rcClient.Width() * 0.90) ; rcControl.bottom = rcControl.top +long(rcClient.Height() * 0.40); m_cboParam.Create(CBS_DROPDOWNLIST|LBS_STANDARD|CBS_SORT|WS_CHILD|WS_VISIBLE, rcControl, this, IDC_PARAM); .... It works, but the problem is that I want to show more items when the user pull the list down. At the moment it shows just two items and I must scroll the list down to see the rest of them. How could I set, maybe the heigth or something else, so it will be able to show more than two items.?? (at least 4 or 5). Setting the amount of items to show in a combobox at design time is easy:->, just clicking over the arrow and then stretch it to the desire height. But how could I set that at runtime??:doh: Thank you.

        Demian. "I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone." -Bjarne Stroustrup, computer science professor, designer of C++ programming language (1950- )

        P Offline
        P Offline
        prasad_som
        wrote on last edited by
        #3

        Demian Panello wrote:

        rcControl.left = long(rcClient.Width() * 0.05); rcControl.top = long(rcClient.Height() * 0.10); rcControl.right = rcControl.left + long(rcClient.Width() * 0.90) ; rcControl.bottom = rcControl.top +long(rcClient.Height() * 0.40); m_cboParam.Create(CBS_DROPDOWNLIST|LBS_STANDARD|CBS_SORT|WS_CHILD|WS_VISIBLE, rcControl, this, IDC_PARAM);

        RECT given while creating combo box should mention that. ie. in this case increase rcControl.bottom value, it will give you desired effect.

        Demian Panello wrote:

        But how could I set that at runtime??

        It is easy ,too. Isn't it?

        Prasad Notifier using ATL | Operator new[],delete[][^]

        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