Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTPItemConstraints::Sort fails to sort
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPItemConstraints::Sort fails to sort

 Post Reply Post Reply
Author
Message
Torlack View Drop Down
Newbie
Newbie


Joined: 01 July 2004
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Torlack Quote  Post ReplyReply Direct Link To This Post Topic: CXTPItemConstraints::Sort fails to sort
    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.
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.043 seconds.