Solved

How to dynamically change a CComboBox from dropdown to dropdown list

Posted on 2004-03-22
7
1,391 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
viewing source code from eclipse 13 89
FizzBuzz challenge 9 77
Detect file exist or not 3 134
Problem to event 3 79
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

863 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now