Solved

CComboBox SetwindowText() with CBS_DROPDOWNLIST style

Posted on 2004-09-22
10
2,226 Views
Last Modified: 2013-11-20
I am trying to use a CComboBox in my application that has a style of CBS_DROPDOWNLIST so the user cannot type his own text in.  However, if there is not a selection (like when the application first comes up) I want the edit section to have the decscription of what is in the box.  I have tried calling SetWindowText() but it doesn't work.  I am assuming because the text I want to set is not found in the combobox droplist.  Is there a way to accomplish this with the MFC CComboBox???

Thanks,
Jedimaster
0
Comment
Question by:Jedimaster
  • 5
  • 3
10 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
Comment Utility
I guess there is not, but you don't have to do this, just create a new item with description, there are many ways to detect that the combobox remains "unselected" (actually is selected item 0)
0
 

Author Comment

by:Jedimaster
Comment Utility
Putting the description in the droplist was my first idea but unfortunatly the powers that be do not like this option... so I have to find another way to accomplish this.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
Comment Utility
You can put description in a static text besides or above combobox
0
 

Author Comment

by:Jedimaster
Comment Utility
Unfortunatly I don't have room on my interface to place a label for this combo....
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 55

Expert Comment

by:Jaime Olivares
Comment Utility
What about a tooltip?
0
 

Author Comment

by:Jedimaster
Comment Utility
nope....

listen... I appreciate your comments but I need to know if there is a way to make the CComboBox do what I need it to do.  If the standard MFC CComboBox will not work for what I need it to do, then I will have to create my own ComboBox that will.  I was just hoping that I was doing something wrong or maybe someone knew about a quirky little hack to force the CComboBox to do what I want.

Again.. no offense.... I just already have a vision of how this interface should look and react.



Thanks,
Jedimaster
0
 
LVL 55

Expert Comment

by:Jaime Olivares
Comment Utility
>If the standard MFC CComboBox will not work for what I need it to do, then I will have to create my own ComboBox that will.
As far as I know is your unique solution. A posible method is to make a CComboBox derived with DROP-DOWN option, and avoid any user input in the edit area.
0
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 250 total points
Comment Utility
Also you can do this. Use a standard CComboBox with DROP-LIST attribute, as I suggested early, with a first "dummy" item showing some explanation. When you detect that user have selected an option, you can delete first item.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
dog bark java program 15 81
while loop over for loop 7 79
ffmpeg - "rtsp://...... Operation not permitted" 4 68
Fibonacci challenge 11 82
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…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

772 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

10 Experts available now in Live!

Get 1:1 Help Now