Solved

Combo Boxes

Posted on 2004-04-03
4
552 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 50 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

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
FMX enumerated colours 2 133
How to split this in C++ 4 118
I could not build boost code, 10 107
C++ help/ Toy problem 19 52
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
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.

756 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