Print Page | Close Window

CXTPItemConstraints::Sort fails to sort

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=1166
Printed Date: 06 November 2025 at 2:19pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPItemConstraints::Sort fails to sort
Posted By: Torlack
Subject: CXTPItemConstraints::Sort fails to sort
Date Posted: 10 September 2004 at 7:28pm
Given the following strings, the sort routine fails:

"Label"
"Button"

posInsert and posSorted are both NULL and this "Button" gets added to the end of the string list.

This is with version 9.0.  We haven't had a chance to install 9.1 so I don't know if this has been fixed yet.



Replies:
Posted By: Oleg
Date Posted: 12 September 2004 at 10:00am

Thank you. The problem you reported has been corrected and will be included in the next product release.

Fixed versrion of Sort method is:

void CXTPItemConstraints::Sort()
{
 CStringList lstSorted;
 POSITION pos = GetHeadPosition();
 while (pos)
 {
  CString str = GetNext(pos);
  
  POSITION posSorted = lstSorted.GetHeadPosition();
  POSITION posInsert = (POSITION)-1;
  while (posSorted)
  {
   if (GetNext(posSorted) > str)
    break;
   
   posInsert = posSorted;
  }
  
  if (posInsert == (POSITION)-1)
   lstSorted.AddHead(str);
  else if (posSorted != posInsert)
   lstSorted.InsertBefore(posInsert, str);
  else lstSorted.AddTail(str);
 }

 RemoveAll();
 AddTail(&lstSorted);
 
}



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net