Solved

How to dynamically change a CComboBox from dropdown to dropdown list

Posted on 2004-03-22
7
1,386 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
Comment Utility
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
Comment Utility
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
Comment Utility
Still awaiting for author feedback
0
 

Author Comment

by:KelvinUnit
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Host to IP 7 73
zeroMAx challenge 20 76
sumHeights2  challenge 7 75
Change to event 1 72
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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 demonstrates a quick way of adding group price to multiple Magento products.

771 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

9 Experts available now in Live!

Get 1:1 Help Now