Solved

How to dynamically change a CComboBox from dropdown to dropdown list

Posted on 2004-03-22
7
1,395 Views
Last Modified: 2013-11-20
How can you change the type of a CComboBox from a dropdown to a dropdownlist after a dialog box has been created? Just changing the window style from CBS_DROPDOWN to CBS_DROPDOWNLIST does not seem to be enough.
0
Comment
Question by:KelvinUnit
  • 2
7 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 125 total points
ID: 10649275
Not all window styles can be changed dynamically. If you try this using SetWindowLong or ModifyStyle and it doesn't work, consider using another solution. For example, two combo boxes with different styles, only one of them is visible. Instead of changing the style hide one and show another.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 10883990
try to call this method for the ComboBox:
    ModifyStyle(CBS_DROPDOWN, CBS_DROPDOWNLIST, SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER);
and
    ModifyStyle(CBS_DROPDOWNLIST, CBS_DROPDOWN, SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER);
alternatively.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11857823
Still awaiting for author feedback
0
 

Author Comment

by:KelvinUnit
ID: 11870690
I intend to ask for this question to be closed and for a refund. Jaime's answer suggests something that I have said does not work in the question and Alex is really just stating the obvious.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question