CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: HSCROLL in CComboBox dropdown

  1. #1
    Join Date
    Jun 2002
    Posts
    1,417

    HSCROLL in CComboBox dropdown

    using MFC I have a CCombBox whose strings are longer than the dropdown is wide. I can not use owner draw because eVC++ 3.0 or VC++ 2005 for smart devices does not support it. Tried autohscroll but that is for the edit control, not the dropdown. Any ideas?

    Thanks

  2. #2
    Join Date
    Feb 2000
    Location
    San Diego, CA
    Posts
    10,354

    Re: HSCROLL in CComboBox dropdown

    CComboBox::SetDroppedWidth

  3. #3
    Join Date
    Jun 2002
    Posts
    1,417

    Re: HSCROLL in CComboBox dropdown

    Thanks for the suggestion. What I failed to mention is that I would like to have a horizontal scroll bar. The screens on wireless devices are only about two inches wide.

  4. #4
    Join Date
    Feb 2000
    Location
    San Diego, CA
    Posts
    10,354

    Re: HSCROLL in CComboBox dropdown

    Try this:
    Code:
    COMBOBOXINFO stComboBoxInfo;
    stComboBoxInfo.cbSize = sizeof(stComboBoxInfo);
    m_oCombo.GetComboBoxInfo(&stComboBoxInfo);
    CListBox oListBox;
    oListBox.Attach(stComboBoxInfo.hwndList);
    oListBox.ModifyStyle(0,WS_HSCROLL);
    oListBox.SetHorizontalExtent(300);
    oListBox.Detach();
    Idea is to add the WS_HSCROLL style to the drop down list box and then also, set the horizontal extent ( MSDN documentation is kind of vague on this, but I guess , if say your listbox width is 200 pixels and your longest text extends upto 300 pixels, you use 300 for the SetHorizontalExtent ). Anyways, upto you to playaround and see if that works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)