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. Combo box height is not increasing

Combo box height is not increasing

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
2 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
    BiswaR
    wrote on last edited by
    #1

    Hi Guys, I have a list control containing 3 columns, When i click on any item in the list box it again pops up a combo box having 3 values.If you select a valu in that combobox then it sets that value to the 2nd column of the list control. But problem is that when i am tring to increase the height of the combo box it's not increasing and reamain same always. I am giving you the whole code. please tell me how to fix this problem. I am trying to increase the rect.bottom in the code -> "PLEASE SEE THIS". This code is not complicated at all and you can ignor many things as the last portion is only important and i have given the comment there. void CListAgr::OnListLButton(WPARAM wParam, LPARAM lParam) { UINT nFlags = lParam; int iItem = wParam; int iItem = m_list_Agr.GetNextItem(-1, LVNI_SELECTED); if (iItem >= 0) // If any item in the list box is selected { CRect rect; int offset = 0; // Make sure that the item is visible m_list_Agr.GetSubItemRect(iItem, 1, LVIR_BOUNDS, rect); // Now scroll if we need to expose the column CRect rcClient; m_list_leaseabs.GetClientRect(rcClient); // Set the scroll size. You can ignore this as it is always false and not // executed if( offset + rect.left < 0 || offset + rect.left > rcClient.right ) { CSize size; size.cx = rect.left; size.cy = 0; m_list_leaseabs.Scroll(size); rect.left -= size.cx; } //Checks if the right edge of combo box is greater than the list control //and if that is true then it will make right edge of combobox equal to // right edge of list control rect.left += offset; rect.right = rect.left + m_list_Agr.GetColumnWidth(1); if(rect.right > rcClient.right) rect.right = rcClient.right; // Here i am setting the length(bottom) of the combo box,creating it and // displaying it. I think there is some problem in the code below. rect.NormalizeRect(); rect.bottom += 10 * rect.Height();//dropdown area "PLEASE SEE THIS" rect.left += 10; rect.right += 10; rect.top += 30; CStringList lstItems; lstItems.AddTail("X"); lstItems.AddTail("Y"); lstItems.AddTail("Z"); CComboBox *pADFList = new CComboInListView(iItem, 1, &lstItems); DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL|CBS_DROPDOWNLIST | CBS_DISABLENOSCROLL; pADFList->Create(dwStyle, rect, this, IDC_COMBOBOXINLISTVIEW); pADFList->ModifyStyleEx(0,WS_EX_CLIENTEDGE); pADFList->SetHorizontalExtent(m_list_Agr.GetColumnWidth(1)); pADFList-

    N 1 Reply Last reply
    0
    • B BiswaR

      Hi Guys, I have a list control containing 3 columns, When i click on any item in the list box it again pops up a combo box having 3 values.If you select a valu in that combobox then it sets that value to the 2nd column of the list control. But problem is that when i am tring to increase the height of the combo box it's not increasing and reamain same always. I am giving you the whole code. please tell me how to fix this problem. I am trying to increase the rect.bottom in the code -> "PLEASE SEE THIS". This code is not complicated at all and you can ignor many things as the last portion is only important and i have given the comment there. void CListAgr::OnListLButton(WPARAM wParam, LPARAM lParam) { UINT nFlags = lParam; int iItem = wParam; int iItem = m_list_Agr.GetNextItem(-1, LVNI_SELECTED); if (iItem >= 0) // If any item in the list box is selected { CRect rect; int offset = 0; // Make sure that the item is visible m_list_Agr.GetSubItemRect(iItem, 1, LVIR_BOUNDS, rect); // Now scroll if we need to expose the column CRect rcClient; m_list_leaseabs.GetClientRect(rcClient); // Set the scroll size. You can ignore this as it is always false and not // executed if( offset + rect.left < 0 || offset + rect.left > rcClient.right ) { CSize size; size.cx = rect.left; size.cy = 0; m_list_leaseabs.Scroll(size); rect.left -= size.cx; } //Checks if the right edge of combo box is greater than the list control //and if that is true then it will make right edge of combobox equal to // right edge of list control rect.left += offset; rect.right = rect.left + m_list_Agr.GetColumnWidth(1); if(rect.right > rcClient.right) rect.right = rcClient.right; // Here i am setting the length(bottom) of the combo box,creating it and // displaying it. I think there is some problem in the code below. rect.NormalizeRect(); rect.bottom += 10 * rect.Height();//dropdown area "PLEASE SEE THIS" rect.left += 10; rect.right += 10; rect.top += 30; CStringList lstItems; lstItems.AddTail("X"); lstItems.AddTail("Y"); lstItems.AddTail("Z"); CComboBox *pADFList = new CComboInListView(iItem, 1, &lstItems); DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL|CBS_DROPDOWNLIST | CBS_DISABLENOSCROLL; pADFList->Create(dwStyle, rect, this, IDC_COMBOBOXINLISTVIEW); pADFList->ModifyStyleEx(0,WS_EX_CLIENTEDGE); pADFList->SetHorizontalExtent(m_list_Agr.GetColumnWidth(1)); pADFList-

      N Offline
      N Offline
      Naveen
      wrote on last edited by
      #2

      To change the height of the combobox change the font height of that combo box. nave

      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