Solved

Keep combobox element in the list, but hide it

Posted on 2008-10-22
2
515 Views
Last Modified: 2013-11-20
Is there a way to keep a combobox element in the index, but hide it from being displayed when the drop down is displayed? I can use DeleteString to get rid of it, but this also destroys the indexing which in my situation is not desirable
0
Comment
Question by:steenpat
2 Comments
 
LVL 14

Accepted Solution

by:
wayside earned 250 total points
ID: 22781361
No can do.

Rather than get the index from the position in the combo dropdown, use SetItemData() to associate the "index" with the element.

When the user makes a selection, a simple call to GetItemData() gets the index back.

When you reinsert the element, use SetItemData() to set its "index" again.
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 22783737
You could make a owner-drawn combobox where you need to do all drawing yourself. Then, you could replace the text to be shown by a blank string or a ------ line. But it is very much efforts for little benefit. You may consider to simply replace the text of the item by somewhat like "--- not selectable ---" and if the user nevertheless makes the selection do it reverse.
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

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…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

911 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

24 Experts available now in Live!

Get 1:1 Help Now