Solved

CComboBox SetwindowText() with CBS_DROPDOWNLIST style

Posted on 2004-09-22
10
2,320 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
10 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12123587
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
ID: 12125643
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
ID: 12125724
You can put description in a static text besides or above combobox
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Jedimaster
ID: 12125742
Unfortunatly I don't have room on my interface to place a label for this combo....
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12125758
What about a tooltip?
0
 

Author Comment

by:Jedimaster
ID: 12125840
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
ID: 12125902
>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
ID: 12125924
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

726 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