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

Thread: Combo Box

  1. #1
    Join Date
    May 1999
    Location
    Malaysia
    Posts
    73

    Combo Box

    I had created a ComboBox using :-


    handle = CreateWindowEx(...,"COMBOBOX",CBS_DROPDOWNLIST | WS_CHILD,...);
    SendMessage(handle,CB_ADDSTRING,0,(LPARAM)(LPSTR)myText);





    It created the ComboBox, and it looks fine. BUT when i clicked the ComboBox, the drop down list appears to be one thin line.
    I had tried :-


    SendMessage(handle,CB_SETITEMHEIGHT,...,...);




    and had used several setting but it still appear as a thin line.

    Please advice,
    Thanks.

    chewlim


  2. #2
    Join Date
    Sep 1999
    Location
    Europe / Austria / Innsbruck
    Posts
    442

    Re: Combo Box

    To set the height of the dropdown listbox you must use the height of the combobox rectangle.

    CreateWindowEx(0, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD,
    0, 0, 50, 100 /*=height including dropdown listbox*/, ...);







  3. #3
    Join Date
    May 1999
    Location
    Malaysia
    Posts
    73

    Re: Combo Box

    Thanks, it works.

    But I another problem, the drop down list doesnt have a scroll bar.
    When my items get larger, the drop down list only display partial list.

    Please advice,
    Thanks.

    chewlim


  4. #4
    Join Date
    Jul 1999
    Location
    Israel
    Posts
    1,793

    Re: Combo Box

    add this WS_VSCROLL o the window style

    handle = CreateWindowEx(...,"COMBOBOX",CBS_DROPDOWNLIST | WS_CHILD |WS_VSCROLL ,...);




    HTH
    kishk91


    [email protected]
    http://www.path.co.il

  5. #5
    Join Date
    Sep 1999
    Location
    Europe / Austria / Innsbruck
    Posts
    442

    Re: Combo Box

    You must create the combobox with the WS_VSCROLL window-style to get a scrollbar.


  6. #6
    Join Date
    Jul 1999
    Location
    Moscow, Russia
    Posts
    667

    Re: Combo Box

    Hi, try this:

    CreateWindowEx(WS_EX_RIGHTSCROLLBAR, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD,0, 0, 50, 100 );



    Good luck,
    Oleg.


  7. #7
    Join Date
    May 1999
    Location
    Malaysia
    Posts
    73

    Re: Combo Box - Thanks Guys

    Thank you for your help...


Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured