?
Solved

Combo Boxes

Posted on 2004-04-03
4
Medium Priority
?
560 Views
Last Modified: 2010-04-01
Two questions:

1. How do I stop listboxes in MFC automatically alphabetising the entries?

2. I've enabled V. Scrollbars, so that all entries cannot fit into the space provided. They work fine in Test Dialog, but not after being compiled, why is that? (The listbox appears normal (with all entries fitting perfectly) with faded scrollbars)

Many thanks
0
Comment
Question by:AmarjitSingh
[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
4 Comments
 
LVL 15

Expert Comment

by:lakshman_ce
ID: 10748857
1. Right click List Box->Properties->Styles->Uncheck 'Sort'
2. Scroll bars will appear only if the list box height is not enough to show the number of entries added to it. Try to add a string in a for loop and you will be able to see the scroll bar.

-Lakshman
0
 

Author Comment

by:AmarjitSingh
ID: 10751338
Thanks, that's #1 solved, but could you expand upon adding a string to a for loop. I know what you mean, say:

for(int i = 2; i > 1; i++) { //entries displayed here }

So the loop will continually run - but where would I place this code: I cannot find where the entries of the listbox are located in my source.

Cheers

0
 

Author Comment

by:AmarjitSingh
ID: 10752797
Okay, I am now knowledgeable of the origin of the invisibility of the scrollbars intended to be present on the combo boxes.

As you may have awareness of, the Test Dialog's generation of the dialog is not accomplished via the usage of the MANIFEST file, which my application indisputably utilises. The MANIFEST file peculiarly has a refusal of displaying the listbox's scrollbars, despite them being strictly defined. This is the explanation for the invisibility of the scrollbars in the solution, but simultaneously the answer to the issue regarding the fact of the presence in Test Dialog.

So, in conclusion, from what has been stated above, undoubtedly, how might I able to achieve the existence of scrollbars in my listboxes, of my compiled solution, whilst concurrently retaining an inclusion of the MANIFEST file?

Thankyou
0
 
LVL 19

Accepted Solution

by:
mrwad99 earned 150 total points
ID: 10800898
The test dialogue has items added to it for the purpose of displaying.  There will be no items in it in the compiled program since VC++ does not add them.  If you want items in the listbox in the compiled EXE you must add them yourself in OnInitDialog() via AddString (http://msdn.microsoft.com/library/en-us/vclib/html/_mfc_CListBox.3a3a.AddString.asp?frame=true).  This is what was mentioned earlier by lakshman_ce; the best place to do this is in a for loop for speed.

If you add enough items to the listbox you will see that the scrollbars become visible; since there is a need for them now.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
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 learn how to clear a vector as well as how to detect empty vectors in C++.

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