![]()  | 
 
CXTPListBase::SortList Method | 
 
    Post Reply  
   | 
  
| Author | |
   
   angelsoriasanagustin  
   
   Groupie  
   Joined: 16 September 2015 Location: Spain Status: Offline Points: 46  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Topic: CXTPListBase::SortList MethodPosted: 14 June 2016 at 12:49pm  | 
 
| 
   
    
   Hi. 
   
  I have a CXTPListCtrl with dates in a column. To sort this data correctly I need to do a custom sort routine. In the documentation I have found CXTPListBase::SortList Method, but there is no explanation about it. Can anyone give me an example about using it ? Thanks. 
    | 
 |
![]()  | 
 |
   
   Alex H.  
   
   Senior Member  
   Joined: 12 February 2004 Status: Offline Points: 266  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 15 June 2016 at 2:15am | 
 
| 
   
    
   Hi! 
   
  Can you sort the items before adding them to the list? :-)  | 
 |
![]()  | 
 |
   
   angelsoriasanagustin  
   
   Groupie  
   Joined: 16 September 2015 Location: Spain Status: Offline Points: 46  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 15 June 2016 at 4:41am | 
 
| 
   
    
   Thanks, but I can't sort before because I have multiple columns, and the user can select what to sort. 
   
  I'm testing CXTPListCtrl::SortList()... It's called when the user clicks in a column... Ok. I'm triying to sort columns using MoveRow() in the function, but doen't work. The rows are sorted by default no matter what I write on the function. Please do a better documentation...  Form Help: 	Override this member function in your derived class to perform custom sort 
routines. How ????  | 
 |
![]()  | 
 |
   
   olebed  
   
   Senior Member  
   Joined: 01 July 2014 Location: Ukraine Status: Offline Points: 841  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 19 June 2016 at 4:00am | 
 
| 
   
    
   Hello, 
   
  You can explore method CXTPShellListBase::SortList CXTPShellListBase is derived from CXTPListBase. Regards, Oleksandr Lebed  | 
 |
![]()  | 
 |
   
   angelsoriasanagustin  
   
   Groupie  
   Joined: 16 September 2015 Location: Spain Status: Offline Points: 46  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 21 June 2016 at 6:16am | 
 
| 
   
    
   Ok, but the help says same: 
   
  Override this member function in your derived class to perform custom sort 
routines. How ????? Thanks. 
    | 
 |
![]()  | 
 |
   
   angelsoriasanagustin  
   
   Groupie  
   Joined: 16 September 2015 Location: Spain Status: Offline Points: 46  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 07 July 2016 at 3:02am | 
 
| 
   
    
   Please... any idea ? 
   
  Thanks 
    | 
 |
![]()  | 
 |
   
   cluster  
   
   Groupie  
   Joined: 22 January 2015 Status: Offline Points: 91  | 
  
   
      Post Options
    
        Thanks(1)
      Quote   Reply
   
     Posted: 07 July 2016 at 5:14am | 
 
| 
   
    
   Hi, 
   
  Codejock used the sort mechanism from CListCtrl: ... m_pListCtrl->SortItems( ListViewCompareProc, (nCol + 1)*(bAscending? 1: -1)); ... so you need a own Callback function like: static int CALLBACK MyCompareProc(LPARAM lparam1, LPARAM lparam2, LPARAM lparamSort); here is an example: http://www.codeproject.com/Articles/1901/Example-of-CListCtrl-SortItems-in-MSDN I hope this helps!  | 
 |
![]()  | 
 |
   
   angelsoriasanagustin  
   
   Groupie  
   Joined: 16 September 2015 Location: Spain Status: Offline Points: 46  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 07 July 2016 at 1:13pm | 
 
| 
   
    
   Thanks for the help... 
   
  I was using other example: http://www.codeproject.com/Articles/27774/CListCtrl-and-sorting-rows The example works with a standar control, but if I use a derived class of CXTPListCtrl no matter what I do, always is sorted by default. My callbackfunction returns rand ()%2, and all is sorted !!! Can be a bug ???? 
    | 
 |
![]()  | 
 |
   
   angelsoriasanagustin  
   
   Groupie  
   Joined: 16 September 2015 Location: Spain Status: Offline Points: 46  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 08 July 2016 at 4:48am | 
 
| 
   
    
   Sorry !!!!  
   
  ![]() I have found the problem. I was sorting twice  ![]() The function works fine. Thaks to all !!!! 
    | 
 |
![]()  | 
 |
    Post Reply  
   | 
  |
|       
  
  Tweet   	
    | 
 
| Forum Jump | Forum Permissions  ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum  |