fpspreadsheet: Fix TsCellCombobox not showing a text for items not in list (https://forum.lazarus.freepascal.org/index.php/topic,42216.msg294319.html#msg294319, modified patch by Soner).

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6602 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-08-14 15:26:19 +00:00
parent d15c90851e
commit e86f39a03c

View File

@ -2851,21 +2851,29 @@ begin
fnt := Worksheet.ReadCellFont(cell);
// No check for nil required because fnt is at least DefaultFont
ItemIndex := Items.IndexOf(fnt.FontName);
if ItemIndex = -1 then
Text := fnt.FontName;
end;
cfiFontSize:
begin
fnt := Worksheet.ReadCellFont(cell);
ItemIndex := Items.IndexOf(Format('%.0f', [fnt.Size]));
if ItemIndex = -1 then
Text := Format('%.2g', [fnt.Size]);
end;
cfiFontColor:
begin
fnt := Worksheet.ReadCellFont(cell);
ItemIndex := Items.IndexOfObject(TObject(PtrInt(fnt.Color)));
if ItemIndex = -1 then
Text := GetColorName(fnt.Color);
end;
cfiBackgroundColor:
begin
clr := Worksheet.ReadBackgroundColor(cell);
ItemIndex := Max(0, Items.IndexOfObject(TObject(PtrInt(clr))));
if ItemIndex = -1 then
Text := GetColorName(clr);
end;
cfiBorderColor:
;