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?
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
rw8Author Commented:
Thanks it's excelletn!
0
Question has a verified solution.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
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.