Solved

Combo Boxes

Posted on 2004-04-03
4
538 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
  • 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need some help with listview limit text 20 103
Retrieve PID of MicrosoftEdge.exe with GetForegroundWindow() 6 148
Best book to learn C++ 4 78
Dialogbox API leak? 18 94
  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 …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

785 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