Solved

CListBox disable/enable sorting

Posted on 2002-07-15
2
1,091 Views
Last Modified: 2013-11-20
Hi can anyone show me the code for disable/enable the sorting function for a CListBox at anytime? Also, is it possible to make it sort in ascending sort or descending order?

i've tried these but it's not working.

m_ctlList.ModifyStyleEx(NULL,LBS_SORT); //to enable sorting
 
0
Comment
Question by:rw8
2 Comments
 

Accepted Solution

by:
skibud2 earned 50 total points
ID: 7156220
from this link,
    http://www.codeproject.com/combobox/listbox_tut.asp

you can find this:

It is not possible to change these styles at runtime even though ModifyStyle() may give the impression it does. If you want turn the Sort style on and off for example it is best to construct the List box by calling new and Create then deleting it and creating a new one when the style is to be changed. Alternatively you can have 2 List box superimposed and hide the one with the incorrect style.

In the Demo the List box headed 'Toggle List Style' which changes the LBN_SORT style. The code deletes the old List box and creates a new one each time the Toggle button is clicked.
0
 

Author Comment

by:rw8
ID: 7156482
Thanks it's excelletn!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now