CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Posts
    28

    CComboBox ModifyStyle() not working?

    hi,
    does anybody have a clue why this is not working?
    myCombo.ModifyStyle(CBS_DROPDOWN, CBS_DROPDOWNLIST);

    or this:
    myCombo.ModifyStyle(CBS_DROPDOWNLIST, CBS_DROPDOWN);

    and this always returns the first option no matter what is the real style (in that case "CBS_DROPDOWN"):

    DWORD d = myCombo.GetStyle();

    if (d & CBS_DROPDOWN)
    AfxMessageBox("CBS_DROPDOWN");
    else
    if (d & CBS_DROPDOWNLIST)
    AfxMessageBox("CBS_DROPDOWNLIST");
    else
    if (d & CBS_SIMPLE)
    AfxMessageBox("CBS_SIMPLE");




    any ideas?
    oren.


  2. #2
    Join Date
    May 1999
    Posts
    667

    Re: CComboBox ModifyStyle() not working?

    This type of change requires you to recreate the window. So you need to DestoryWindow();
    Create(...

    Your other option is to have both control types createdd and then hide the one you don't need and kepp them in sync.

    HTH,
    Chris


  3. #3
    Join Date
    May 1999
    Posts
    28

    Re: CComboBox ModifyStyle() not working?

    hi Chris,
    first - thanks.
    second - i had tried both methods and eventually decided on a completely different approach.
    even though i have a question and a comment about your first option:
    1. how can one know whether a style is 'modifyable' or not?
    2. in my endless attempts to modify the style i did manage to modify it correctly,
    but then i did some 'improvements' and lost the case. the sad thing was
    that somehow i didn't manage to do it again. so - if i'm not wrong, this specific task
    can be made without recreating the control.
    thanks again, oren.


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