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