From e94ee856a782ef355b371040bd48179af72579bb Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Fri, 13 Jun 2014 08:33:41 +0000 Subject: [PATCH] fpspreadsheet: Fix selection of date/time formats in fpsgrid demo git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3161 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../fpspreadsheet/examples/fpsgrid/mainform.pas | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/components/fpspreadsheet/examples/fpsgrid/mainform.pas b/components/fpspreadsheet/examples/fpsgrid/mainform.pas index a947f8976..67a0bcb25 100644 --- a/components/fpspreadsheet/examples/fpsgrid/mainform.pas +++ b/components/fpspreadsheet/examples/fpsgrid/mainform.pas @@ -488,16 +488,19 @@ var fmt: String; decs: Byte; cs: String; + isDateTimeFmt: Boolean; begin if TAction(Sender).Checked then nf := TsNumberFormat((TAction(Sender).Tag - NUMFMT_TAG) div 10) else nf := nfGeneral; - if nf = nfCustom then - fmt := DATETIME_CUSTOM[TAction(Sender).Tag mod 10] - else - fmt := ''; + fmt := ''; + isDateTimeFmt := IsDateTimeFormat(nf); + if nf = nfCustom then begin + fmt := DATETIME_CUSTOM[TAction(Sender).Tag mod 10]; + isDateTimeFmt := true; + end; with WorksheetGrid do begin c := GetWorksheetCol(Col); @@ -506,7 +509,7 @@ begin Worksheet.GetNumberFormatAttributes(cell, decs, cs); case cell^.ContentType of cctNumber, cctDateTime: - if IsDateTimeFormat(nf) then begin + if isDateTimeFmt then begin if IsDateTimeFormat(cell^.NumberFormat) then Worksheet.WriteDateTime(cell, cell^.DateTimeValue, nf, fmt) else @@ -890,6 +893,7 @@ begin ac.Checked := found; end; end; + Invalidate; end; end;