?
Solved

CComboBox SetwindowText() with CBS_DROPDOWNLIST style

Posted on 2004-09-22
10
Medium Priority
?
2,409 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
Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit 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 1000 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

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 will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

777 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