Link to home
Start Free TrialLog in
Avatar of jadcock
jadcock

asked on

Turn off sorting in CListCtrl

I've got a CListCtrl in a dialog that has a list of files as it's items, and some other data (for each file) as subitems. I'd like to have the thing automatically sort the list (by setting the "sort" option in the resource editor), rather than having to manually sort the list. The problem comes when I want to add a new file (and associated subitems) to the list. My idea was to use InsertItem to add the filename at the end of the list, and then SetItem to add the associated subitems. However, when I call InsertItem(), the control immediately resorts the list, so the item I just added is no longer where I put it; consequently, I don't know which item # to use in the call to SetItem().

Finally, the question: is there a way to temporarily disable the control's sorting until I finish adding the subitems?
ASKER CERTIFIED SOLUTION
Avatar of Belgarat
Belgarat

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jadcock
jadcock

ASKER

Aaargh! The answer's so obvious, it's gotta be right! Thanks.