#1 2018-02-22 12:59:49

xalo
Member
Registered: 2016-09-22
Posts: 32

Possible little bug in TSQLTableToGrid.SetCustomFormatByType...

I've found in TSQLTableToGrid.SetCustomFormatByType or TSQLTableToGrid.CustomFormat when Fieldtype is sftCreateTime or sftModTime the output is not the expected.

I think the issue is in the following code in mORMotUI.pas:

      case Table.ExpandAsString(ARow,ACol,Client,StringValue,GetCustomFormat(ACol)) of
      // very fast response (calculated once)
      sftBoolean:
        // display boolean as checkbox
        DrawCheckBox(TDrawGrid(Owner).Handle, Handle, Rect,
          PWord(Table.Get(ARow,ACol))^<>ord('0')); // fast StrComp(,'0')
      sftInteger, sftFloat, sftCurrency,
      sftEnumerate, sftTimeLog, sftRecord,
      sftDateTime, sftDateTimeMS, sftUnixTime, sftUnixMSTime:
        ExtTextOut(Handle, Rect.Left+XInc, Rect.Top+2, Options, @Rect, pointer(StringValue),
          length(StringValue), nil); // translated short text

and it should be: (I've added sftCreateTime, sftModTime)

      case Table.ExpandAsString(ARow,ACol,Client,StringValue,GetCustomFormat(ACol)) of
      // very fast response (calculated once)
      sftBoolean:
        // display boolean as checkbox
        DrawCheckBox(TDrawGrid(Owner).Handle, Handle, Rect,
          PWord(Table.Get(ARow,ACol))^<>ord('0')); // fast StrComp(,'0')
      sftInteger, sftFloat, sftCurrency,
      sftEnumerate, sftTimeLog, sftCreateTime, sftModTime, sftRecord,
      sftDateTime, sftDateTimeMS, sftUnixTime, sftUnixMSTime:
        ExtTextOut(Handle, Rect.Left+XInc, Rect.Top+2, Options, @Rect, pointer(StringValue),
          length(StringValue), nil); // translated short text

Many thanks in advance

Offline

Board footer

Powered by FluxBB