Skip to main content

How to Convert the cxDueTimeInfoToText Routine From Delphi Into C++ Code

It is sometimes required to customize information provided by the cxDueTimeInfoToText routine (for example, for the localization purposes).

To do this, implement a custom routine. To inform a scheduler that a new routine is to be invoked in the application, use the cxDueTimeInfoToTextProc constant.

The following example demonstrates how to implement this routine in C++ code:

// ...
AnsiString __fastcall <Form>::cxMyDueTimeInfoToText(const TcxSchedulerReminderDueTimeInfo &AInfo) {
  if (AInfo.DueKind == Cxschedulerstorage::dtkNow) {
    return "Now";
  } 
  else {
    AnsiString ElementNames[] = {"minute", "hour", "day", "week"};
    AnsiString Res = Format("%d %s", ARRAYOFCONST((AInfo.ElementValue, ElementNames[AInfo.Element])));
    if (AInfo.ElementValue > 1)
      Res = Res + "s";
    if (AInfo.DueKind == Cxschedulerstorage::dtkOverdue)
      Res = Res + " overdue";
    return Res;
  }
}
See Also