Solved

Keep combobox element in the list, but hide it

Posted on 2008-10-22
2
519 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
[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
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

Independent Software Vendors: 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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

728 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