ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 ImageEnFolderMView sort doesn't match Windows

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Waheed Posted - Oct 17 2019 : 16:13:28
ImageEnFolderMView sort order doesn't match Windows (10) sort order when using filename and international characters.
Using ImageEnFolderMView demo I opened the same folder as in Windows Explorer but look at the end of the list of files in the given image.





-----------------
3 Monitors
Windows 10
Delphi 6,2007 and 10.2
ImageEn v.8.7
6   L A T E S T    R E P L I E S    (Newest First)
Waheed Posted - Oct 20 2019 : 22:31:01
No, none made a difference. Here is the list of file names for anyone to test. You can just create/duplicate a file, then rename it using the provided names.

attach/Waheed/20191020223043_FolderView.txt

-----------------
3 Monitors
Windows 10
Delphi 6,2007 and 10.2
ImageEn v.8.7
xequte Posted - Oct 19 2019 : 15:36:40
Hi

Those looks correct. Did any of them give more favorable sorting?

Nigel
Xequte Software
www.imageen.com
Waheed Posted - Oct 19 2019 : 00:09:31
I test multiple methods of sorting (I did select custom sort and added this to the OnSortCompare event:
CompareStringW and CompareStringEx took too long that I had to terminate it.

case cmbSortType.ItemIndex of
    0: Result := StrCmpLogicalW(PWideChar(Filename1),PWideChar(Filename2));
    1: Result := CompareStringW(LOCALE_CUSTOM_DEFAULT, LINGUISTIC_IGNOREDIACRITIC,
             PWideChar(Filename1), length(PWideChar(Filename1)), PWideChar(Filename2), length(PWideChar(Filename2)));
    2: Result := CompareStringEx(LOCALE_NAME_INVARIANT, 0, PWideChar(Filename1), -1, PWideChar(Filename2), -1, nil, nil, 0);
    3: Result := CompareStringOrdinal(PWideChar(Filename1),  length(PWideChar(Filename2)), PWideChar(Filename2),  length(PWideChar(Filename2)), true);
   end;


Is this the correct way of implementing these methods?

-----------------
3 Monitors
Windows 10
Delphi 6,2007 and 10.2
ImageEn v.8.7
xequte Posted - Oct 17 2019 : 23:23:18
Hi Waheed

Please test StrCmpLogicalW:

https://docs.microsoft.com/en-us/windows/win32/api/shlwapi/nf-shlwapi-strcmplogicalw

In a TStringList as outlined in the Delphi code here:

https://stackoverflow.com/questions/5134712/how-to-get-the-sort-order-in-delphi-as-in-windows-explorer

How does that compare to CompareText?



Nigel
Xequte Software
www.imageen.com
Waheed Posted - Oct 17 2019 : 23:08:48
It's not only strings, also special characters like
[
is not in the correct order.



I'm no expert, but I would look into these pages thoroughly :

https://stackoverflow.com/questions/2279789/comparing-and-sorting-unicode-filenames

https://docs.microsoft.com/en-us/windows/win32/intl/handling-sorting-in-your-applications?redirectedfrom=MSDN



-----------------
3 Monitors
Windows 10
Delphi 6,2007 and 10.2
ImageEn v.8.7
xequte Posted - Oct 17 2019 : 21:37:11
Hi Waheed

ImageEn uses either CompareStr (case-sensitive) or CompareText(not case-sensitive) to handle the sorting. Do you know of an alternative method?



Nigel
Xequte Software
www.imageen.com