?
Solved

Keep combobox element in the list, but hide it

Posted on 2008-10-22
2
Medium Priority
?
520 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 1000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

771 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