Solved

CListBox disable/enable sorting

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
windows 10 how make picture as desktop background 2 73
Detect CR LF to each line 12 185
zeroFront challenge 7 136
Adjust the codes 3 63
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

739 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