Solved

Keep combobox element in the list, but hide it

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sed question 2 124
gdb doesn't stop on breakpoint 2 114
Way to decrease size of apk file 9 110
Coding for the first time 9 70
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…
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 viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

730 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