CListBox custom sort

CListBox custom sort

Post by Josh Finlayso » Tue, 15 Jul 2003 09:28:01



I'm trying to implement custom sorting of string items in
a list box using the MFC CListBox class. I've sub-classed
the control and am using this subclass as the control type
in the dialog in which the control sits (I hope that makes
sense).

From what I've read, CE doesn't support owner drawn list
boxes - can I still meaningfully override the CompareItems
function and have it called when appropriate?? I've tried
this, but the function never seems to be called.

As you've probably guessed I'm a bit of an MFC newbie -
any help would be greatly appreciated.

Cheers,
Josh

 
 
 

CListBox custom sort

Post by Alexander Shargi » Tue, 15 Jul 2003 17:04:08


Since CompareItem seems to be part of owner-draw mechanism (which is not
supported on CE), this probably will not work. You will have to manually
sort itms and add hem to list in correct order. Or take a look at list view
control (CListCtrl in MFC). It does support owner-draw.

--
Sincerely,
Alexander


http://www.RSDN.ru - Russian Software Developer Network


Quote:> I'm trying to implement custom sorting of string items in
> a list box using the MFC CListBox class. I've sub-classed
> the control and am using this subclass as the control type
> in the dialog in which the control sits (I hope that makes
> sense).

> From what I've read, CE doesn't support owner drawn list
> boxes - can I still meaningfully override the CompareItems
> function and have it called when appropriate?? I've tried
> this, but the function never seems to be called.

> As you've probably guessed I'm a bit of an MFC newbie -
> any help would be greatly appreciated.

> Cheers,
> Josh


 
 
 

1. Explorer sorts files incorrectly when set to sort by Type & Sort in groups

I'm running WinXP Pro. When I set a folder to be sorted by 'Type' and
'Sorted in groups' the files are placed in the correct groups but they
are not sorted alphabetically. I have to press Refresh to get the files
to sort correctly. Then, the next time I open that folder, the same
problem occurs. I am having to press refresh every time I open any
folder in Explorer.

I have both versions of TweakUI installed and I have 'Save explorer
settings' checked, but to no avail. Can anyone help?!?!?

--
devin
remove the NOSPAM in
my address to email me

2. MS Internet Keyboard driver intermittently fails to load...

3. Explorer sorts incorrectly when set to sort by Type -> Sort in groups

4. lag time

5. XP MediaPlayer custom PlayList sort by name

6. singup automaticallyu

7. Custom Toolbars-Shortcuts will not stay sorted

8. Critical Update Fails to Load

9. Adding Custom Attributes to a Folders for Userdefined sorting in Windows Explorer

10. Custom Menu sort of works

11. Custom sorting of MSFlexGrid

12. Sorted column won't stay sorted

13. Arrange icons by name sorts into 2 sorted sets