You've already forked lazarus-ccr
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
This commit is contained in:
@ -488,16 +488,19 @@ var
|
|||||||
fmt: String;
|
fmt: String;
|
||||||
decs: Byte;
|
decs: Byte;
|
||||||
cs: String;
|
cs: String;
|
||||||
|
isDateTimeFmt: Boolean;
|
||||||
begin
|
begin
|
||||||
if TAction(Sender).Checked then
|
if TAction(Sender).Checked then
|
||||||
nf := TsNumberFormat((TAction(Sender).Tag - NUMFMT_TAG) div 10)
|
nf := TsNumberFormat((TAction(Sender).Tag - NUMFMT_TAG) div 10)
|
||||||
else
|
else
|
||||||
nf := nfGeneral;
|
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
|
with WorksheetGrid do begin
|
||||||
c := GetWorksheetCol(Col);
|
c := GetWorksheetCol(Col);
|
||||||
@ -506,7 +509,7 @@ begin
|
|||||||
Worksheet.GetNumberFormatAttributes(cell, decs, cs);
|
Worksheet.GetNumberFormatAttributes(cell, decs, cs);
|
||||||
case cell^.ContentType of
|
case cell^.ContentType of
|
||||||
cctNumber, cctDateTime:
|
cctNumber, cctDateTime:
|
||||||
if IsDateTimeFormat(nf) then begin
|
if isDateTimeFmt then begin
|
||||||
if IsDateTimeFormat(cell^.NumberFormat) then
|
if IsDateTimeFormat(cell^.NumberFormat) then
|
||||||
Worksheet.WriteDateTime(cell, cell^.DateTimeValue, nf, fmt)
|
Worksheet.WriteDateTime(cell, cell^.DateTimeValue, nf, fmt)
|
||||||
else
|
else
|
||||||
@ -890,6 +893,7 @@ begin
|
|||||||
ac.Checked := found;
|
ac.Checked := found;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user