OnCustomCompare not triggered


I'm using FMX Pack up to date ( with C++ Builder XE4.

I'm trying to use custom sort on my grid, but it doesn't work.

I've defined SortFormat to ssCustom inside the OnSortFormat event

void __fastcall TFrmEvenementiel::GridTasksSortFormat(TObject *Sender, int Col, TSortFormat &SortFormat,
		  UnicodeString &APrefix, UnicodeString &ASuffix)
	if (Col==6) {
		SortFormat == ssCustom;

then I've defined my compare function on the OnCurtomCompare event, but it is never triggered.

void __fastcall TFrmEvenementiel::GridTasksCustomCompare(TObject *Sender, UnicodeString Value1,
          UnicodeString Value2, int &res)
TDateTime date1 = StrToDateTime(Value1);
	TDateTime date2 = StrToDateTime(Value2);

if (date1<date2) {
  res = -1;
} else if (date1==date2) {
 	res = 0;
	} else {
 res = 1;


I precise that step by step execution shows that the compare function is not executed.

I think I correctly use the custom sort functionnality, maybe i'm wrong ? 

any help will be appreciated

Thanks !

The SortFormat == ssCustom is a comparisation and not an assignment.
Please use SortFormat = ssCustom instead without the additional "=" sign.

Pieter Scheldeman2014-04-30 08:08:02