Solved

CListBox disable/enable sorting

Posted on 2002-07-15
2
1,116 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
while loop over for loop 7 103
FizzBuzz challenge 9 80
Excel file not created as expected 7 72
Capture logon name 13 73
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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

770 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