Back to Devexpress

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

vcl-151001-expressscheduler-how-to-convert-the-cxduetimeinfototext-routine-from-delphi-into-c-code.md

latest1.2 KB
Original Source

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

  • Dec 28, 2020

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:

cpp
// ...
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

cxSchedulerStorage.cxDueTimeInfoToText