diff --git a/components/fpspreadsheet/examples/fpsgrid/fpsgrid.lpi b/components/fpspreadsheet/examples/fpsgrid/fpsgrid.lpi index f159a6c99..a98f36651 100644 --- a/components/fpspreadsheet/examples/fpsgrid/fpsgrid.lpi +++ b/components/fpspreadsheet/examples/fpsgrid/fpsgrid.lpi @@ -116,7 +116,7 @@ - + @@ -128,34 +128,34 @@ - - - - - - + + + + - - - + + + - - - - + + + + + + @@ -224,10 +224,12 @@ + - - - + + + + @@ -236,7 +238,7 @@ - + @@ -266,9 +268,9 @@ - - - + + + @@ -291,9 +293,9 @@ - - - + + + @@ -303,7 +305,7 @@ - + @@ -313,7 +315,7 @@ - + @@ -490,134 +492,132 @@ - - - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/components/fpspreadsheet/examples/fpsgrid/mainform.lfm b/components/fpspreadsheet/examples/fpsgrid/mainform.lfm index f6d1c9608..d5552696b 100644 --- a/components/fpspreadsheet/examples/fpsgrid/mainform.lfm +++ b/components/fpspreadsheet/examples/fpsgrid/mainform.lfm @@ -4,7 +4,7 @@ object Form1: TForm1 Top = 258 Width = 636 Caption = 'fpsGrid' - ClientHeight = 381 + ClientHeight = 386 ClientWidth = 636 Menu = MainMenu1 OnActivate = FormActivate @@ -14,7 +14,7 @@ object Form1: TForm1 object Panel1: TPanel Left = 0 Height = 73 - Top = 308 + Top = 313 Width = 636 Align = alBottom BevelOuter = bvNone @@ -23,9 +23,9 @@ object Form1: TForm1 TabOrder = 0 object CbShowHeaders: TCheckBox Left = 8 - Height = 24 + Height = 19 Top = 11 - Width = 116 + Width = 93 Caption = 'Show headers' Checked = True OnClick = CbShowHeadersClick @@ -34,9 +34,9 @@ object Form1: TForm1 end object CbShowGridLines: TCheckBox Left = 8 - Height = 24 + Height = 19 Top = 36 - Width = 125 + Width = 100 Caption = 'Show grid lines' Checked = True OnClick = CbShowGridLinesClick @@ -45,7 +45,7 @@ object Form1: TForm1 end object EdFrozenCols: TSpinEdit Left = 238 - Height = 28 + Height = 23 Top = 8 Width = 52 OnChange = EdFrozenColsChange @@ -53,7 +53,7 @@ object Form1: TForm1 end object EdFrozenRows: TSpinEdit Left = 238 - Height = 28 + Height = 23 Top = 39 Width = 52 OnChange = EdFrozenRowsChange @@ -61,18 +61,18 @@ object Form1: TForm1 end object Label1: TLabel Left = 152 - Height = 20 + Height = 15 Top = 13 - Width = 77 + Width = 62 Caption = 'Frozen cols:' FocusControl = EdFrozenCols ParentColor = False end object Label2: TLabel Left = 153 - Height = 20 + Height = 15 Top = 40 - Width = 82 + Width = 66 Caption = 'Frozen rows:' FocusControl = EdFrozenRows ParentColor = False @@ -80,7 +80,7 @@ object Form1: TForm1 end object PageControl1: TPageControl Left = 0 - Height = 250 + Height = 255 Top = 58 Width = 636 ActivePage = TabSheet1 @@ -90,11 +90,11 @@ object Form1: TForm1 OnChange = PageControl1Change object TabSheet1: TTabSheet Caption = 'Sheet1' - ClientHeight = 217 + ClientHeight = 227 ClientWidth = 628 object sWorksheetGrid1: TsWorksheetGrid Left = 0 - Height = 217 + Height = 227 Top = 0 Width = 628 FrozenCols = 0 @@ -108,7 +108,7 @@ object Form1: TForm1 TitleStyle = tsNative OnSelectCell = sWorksheetGrid1SelectCell ColWidths = ( - 56 + 42 64 ) end @@ -184,19 +184,19 @@ object Form1: TForm1 end object FontComboBox: TComboBox Left = 1 - Height = 28 + Height = 23 Top = 2 Width = 127 - ItemHeight = 20 + ItemHeight = 15 OnSelect = FontComboBoxSelect TabOrder = 0 end object FontSizeComboBox: TComboBox Left = 128 - Height = 28 + Height = 23 Top = 2 Width = 48 - ItemHeight = 20 + ItemHeight = 15 Items.Strings = ( '8' '9' diff --git a/components/fpspreadsheet/examples/fpsgrid/mainform.lrs b/components/fpspreadsheet/examples/fpsgrid/mainform.lrs index 3582eec71..776808ba1 100644 --- a/components/fpspreadsheet/examples/fpsgrid/mainform.lrs +++ b/components/fpspreadsheet/examples/fpsgrid/mainform.lrs @@ -2,74 +2,74 @@ LazarusResources.Add('TForm1','FORMDATA',[ 'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'r'#1#6'Height'#3#150#1#3'Top'#3#2#1#5'Wid' - +'th'#3'|'#2#7'Caption'#6#7'fpsGrid'#12'ClientHeight'#3'}'#1#11'ClientWidth'#3 - +'|'#2#4'Menu'#7#9'MainMenu1'#10'OnActivate'#7#12'FormActivate'#8'OnCreate'#7 - +#10'FormCreate'#8'ShowHint'#9#10'LCLVersion'#6#3'1.3'#0#6'TPanel'#6'Panel1'#4 - +'Left'#2#0#6'Height'#2'I'#3'Top'#3'4'#1#5'Width'#3'|'#2#5'Align'#7#8'alBotto' - +'m'#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2'I'#11'ClientWidth'#3'|'#2#8 - +'TabOrder'#2#0#0#9'TCheckBox'#13'CbShowHeaders'#4'Left'#2#8#6'Height'#2#24#3 - +'Top'#2#11#5'Width'#2't'#7'Caption'#6#12'Show headers'#7'Checked'#9#7'OnClic' - +'k'#7#18'CbShowHeadersClick'#5'State'#7#9'cbChecked'#8'TabOrder'#2#0#0#0#9'T' - +'CheckBox'#15'CbShowGridLines'#4'Left'#2#8#6'Height'#2#24#3'Top'#2'$'#5'Widt' - +'h'#2'}'#7'Caption'#6#15'Show grid lines'#7'Checked'#9#7'OnClick'#7#20'CbSho' - +'wGridLinesClick'#5'State'#7#9'cbChecked'#8'TabOrder'#2#1#0#0#9'TSpinEdit'#12 - +'EdFrozenCols'#4'Left'#3#238#0#6'Height'#2#28#3'Top'#2#8#5'Width'#2'4'#8'OnC' - +'hange'#7#18'EdFrozenColsChange'#8'TabOrder'#2#2#0#0#9'TSpinEdit'#12'EdFroze' - +'nRows'#4'Left'#3#238#0#6'Height'#2#28#3'Top'#2''''#5'Width'#2'4'#8'OnChange' - +#7#18'EdFrozenRowsChange'#8'TabOrder'#2#3#0#0#6'TLabel'#6'Label1'#4'Left'#3 - +#152#0#6'Height'#2#20#3'Top'#2#13#5'Width'#2'M'#7'Caption'#6#12'Frozen cols:' - +#12'FocusControl'#7#12'EdFrozenCols'#11'ParentColor'#8#0#0#6'TLabel'#6'Label' - +'2'#4'Left'#3#153#0#6'Height'#2#20#3'Top'#2'('#5'Width'#2'R'#7'Caption'#6#12 - +'Frozen rows:'#12'FocusControl'#7#12'EdFrozenRows'#11'ParentColor'#8#0#0#0#12 - +'TPageControl'#12'PageControl1'#4'Left'#2#0#6'Height'#3#250#0#3'Top'#2':'#5 - +'Width'#3'|'#2#10'ActivePage'#7#9'TabSheet1'#5'Align'#7#8'alClient'#8'TabInd' - +'ex'#2#0#8'TabOrder'#2#1#8'OnChange'#7#18'PageControl1Change'#0#9'TTabSheet' - +#9'TabSheet1'#7'Caption'#6#6'Sheet1'#12'ClientHeight'#3#217#0#11'ClientWidth' - +#3't'#2#0#15'TsWorksheetGrid'#15'sWorksheetGrid1'#4'Left'#2#0#6'Height'#3#217 - +#0#3'Top'#2#0#5'Width'#3't'#2#10'FrozenCols'#2#0#10'FrozenRows'#2#0#5'Align' - +#7#8'alClient'#8'ColCount'#2#2#14'ExtendedSelect'#8#7'Options'#11#15'goFixed' - +'VertLine'#15'goFixedHorzLine'#10'goVertLine'#10'goHorzLine'#13'goRangeSelec' - +'t'#11'goRowSizing'#11'goColSizing'#15'goThumbTracking'#14'goSmoothScroll'#16 - +'goFixedColSizing'#0#8'RowCount'#2#2#8'TabOrder'#2#0#10'TitleStyle'#7#8'tsNa' - +'tive'#12'OnSelectCell'#7#25'sWorksheetGrid1SelectCell'#9'ColWidths'#1#2'8'#2 - +'@'#0#0#0#0#0#8'TToolBar'#8'ToolBar1'#4'Left'#2#0#6'Height'#2#26#3'Top'#2#0#5 - +'Width'#3'|'#2#12'ButtonHeight'#2#24#7'Caption'#6#8'ToolBar1'#11'EdgeBorders' - +#11#0#6'Images'#7#10'ImageList1'#8'TabOrder'#2#2#0#11'TToolButton'#11'ToolBu' - +'tton1'#4'Left'#2#1#3'Top'#2#0#6'Action'#7#6'AcOpen'#0#0#11'TToolButton'#11 - +'ToolButton2'#4'Left'#2#24#3'Top'#2#0#6'Action'#7#8'AcSaveAs'#0#0#11'TToolBu' - +'tton'#11'ToolButton3'#4'Left'#2'P'#3'Top'#2#0#6'Action'#7#6'AcQuit'#0#0#11 - +'TToolButton'#11'ToolButton5'#4'Left'#2'/'#3'Top'#2#0#5'Width'#2#5#7'Caption' - +#6#11'ToolButton5'#5'Style'#7#10'tbsDivider'#0#0#11'TToolButton'#11'ToolButt' - +'on4'#4'Left'#2'4'#3'Top'#2#0#6'Action'#7#6'AcEdit'#0#0#11'TToolButton'#11'T' - +'oolButton6'#4'Left'#2'K'#3'Top'#2#0#5'Width'#2#5#7'Caption'#6#11'ToolButton' - +'6'#5'Style'#7#10'tbsDivider'#0#0#0#8'TToolBar'#13'FormatToolBar'#4'Left'#2#0 - +#3'Top'#2#26#5'Width'#3'|'#2#12'ButtonHeight'#2#28#7'Caption'#6#13'FormatToo' - +'lBar'#6'Images'#7#10'ImageList1'#8'TabOrder'#2#3#0#11'TToolButton'#12'ToolB' - +'utton10'#4'Left'#3#17#1#3'Top'#2#2#6'Action'#7#11'AcLeftAlign'#0#0#11'TTool' - +'Button'#12'ToolButton12'#4'Left'#3'('#1#3'Top'#2#2#6'Action'#7#16'AcHorCent' - +'erAlign'#0#0#11'TToolButton'#12'ToolButton13'#4'Left'#3'?'#1#3'Top'#2#2#6'A' - +'ction'#7#12'AcRightAlign'#0#0#9'TComboBox'#12'FontComboBox'#4'Left'#2#1#6'H' - +'eight'#2#28#3'Top'#2#2#5'Width'#2#127#10'ItemHeight'#2#20#8'OnSelect'#7#18 - +'FontComboBoxSelect'#8'TabOrder'#2#0#0#0#9'TComboBox'#16'FontSizeComboBox'#4 - +'Left'#3#128#0#6'Height'#2#28#3'Top'#2#2#5'Width'#2'0'#10'ItemHeight'#2#20#13 - +'Items.Strings'#1#6#1'8'#6#1'9'#6#2'10'#6#2'11'#6#2'12'#6#2'14'#6#2'16'#6#2 - +'18'#6#2'20'#6#2'24'#0#8'OnSelect'#7#18'FontComboBoxSelect'#8'TabOrder'#2#1#0 - +#0#11'TToolButton'#11'ToolButton7'#4'Left'#3#176#0#3'Top'#2#2#6'Action'#7#10 - +'AcFontBold'#0#0#11'TToolButton'#11'ToolButton8'#4'Left'#3#199#0#3'Top'#2#2#6 - +'Action'#7#12'AcFontItalic'#0#0#11'TToolButton'#11'ToolButton9'#4'Left'#3#222 - +#0#3'Top'#2#2#6'Action'#7#15'AcFontUnderline'#0#0#11'TToolButton'#12'ToolBut' - +'ton11'#4'Left'#3#245#0#3'Top'#2#2#6'Action'#7#15'AcFontStrikeout'#0#0#11'TT' - +'oolButton'#12'ToolButton14'#4'Left'#3#12#1#3'Top'#2#2#5'Width'#2#5#7'Captio' - +'n'#6#12'ToolButton14'#5'Style'#7#10'tbsDivider'#0#0#11'TToolButton'#12'Tool' - +'Button15'#4'Left'#3'V'#1#3'Top'#2#2#5'Width'#2#5#7'Caption'#6#12'ToolButton' - +'15'#5'Style'#7#10'tbsDivider'#0#0#11'TToolButton'#12'ToolButton16'#4'Left'#3 - +'['#1#3'Top'#2#2#6'Action'#7#11'AcVAlignTop'#0#0#11'TToolButton'#12'ToolButt' - +'on17'#4'Left'#3'r'#1#3'Top'#2#2#6'Action'#7#14'AcVAlignCenter'#0#0#11'TTool' - ,'Button'#12'ToolButton18'#4'Left'#3#137#1#3'Top'#2#2#6'Action'#7#14'AcVAlign' - +'Bottom'#0#0#11'TToolButton'#12'ToolButton19'#4'Left'#3#160#1#3'Top'#2#2#5'W' - +'idth'#2#5#7'Caption'#6#12'ToolButton19'#5'Style'#7#10'tbsDivider'#0#0#11'TT' - +'oolButton'#12'ToolButton20'#4'Left'#3#165#1#3'Top'#2#2#6'Action'#7#12'AcBor' - +'derLeft'#0#0#11'TToolButton'#12'ToolButton21'#4'Left'#3#188#1#3'Top'#2#2#6 + +'th'#3'|'#2#7'Caption'#6#7'fpsGrid'#12'ClientHeight'#3#130#1#11'ClientWidth' + +#3'|'#2#4'Menu'#7#9'MainMenu1'#10'OnActivate'#7#12'FormActivate'#8'OnCreate' + +#7#10'FormCreate'#8'ShowHint'#9#10'LCLVersion'#6#3'1.3'#0#6'TPanel'#6'Panel1' + +#4'Left'#2#0#6'Height'#2'I'#3'Top'#3'9'#1#5'Width'#3'|'#2#5'Align'#7#8'alBot' + +'tom'#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2'I'#11'ClientWidth'#3'|'#2 + +#8'TabOrder'#2#0#0#9'TCheckBox'#13'CbShowHeaders'#4'Left'#2#8#6'Height'#2#19 + +#3'Top'#2#11#5'Width'#2']'#7'Caption'#6#12'Show headers'#7'Checked'#9#7'OnCl' + +'ick'#7#18'CbShowHeadersClick'#5'State'#7#9'cbChecked'#8'TabOrder'#2#0#0#0#9 + +'TCheckBox'#15'CbShowGridLines'#4'Left'#2#8#6'Height'#2#19#3'Top'#2'$'#5'Wid' + +'th'#2'd'#7'Caption'#6#15'Show grid lines'#7'Checked'#9#7'OnClick'#7#20'CbSh' + +'owGridLinesClick'#5'State'#7#9'cbChecked'#8'TabOrder'#2#1#0#0#9'TSpinEdit' + +#12'EdFrozenCols'#4'Left'#3#238#0#6'Height'#2#23#3'Top'#2#8#5'Width'#2'4'#8 + +'OnChange'#7#18'EdFrozenColsChange'#8'TabOrder'#2#2#0#0#9'TSpinEdit'#12'EdFr' + +'ozenRows'#4'Left'#3#238#0#6'Height'#2#23#3'Top'#2''''#5'Width'#2'4'#8'OnCha' + +'nge'#7#18'EdFrozenRowsChange'#8'TabOrder'#2#3#0#0#6'TLabel'#6'Label1'#4'Lef' + +'t'#3#152#0#6'Height'#2#15#3'Top'#2#13#5'Width'#2'>'#7'Caption'#6#12'Frozen ' + +'cols:'#12'FocusControl'#7#12'EdFrozenCols'#11'ParentColor'#8#0#0#6'TLabel'#6 + +'Label2'#4'Left'#3#153#0#6'Height'#2#15#3'Top'#2'('#5'Width'#2'B'#7'Caption' + +#6#12'Frozen rows:'#12'FocusControl'#7#12'EdFrozenRows'#11'ParentColor'#8#0#0 + +#0#12'TPageControl'#12'PageControl1'#4'Left'#2#0#6'Height'#3#255#0#3'Top'#2 + +':'#5'Width'#3'|'#2#10'ActivePage'#7#9'TabSheet1'#5'Align'#7#8'alClient'#8'T' + +'abIndex'#2#0#8'TabOrder'#2#1#8'OnChange'#7#18'PageControl1Change'#0#9'TTabS' + +'heet'#9'TabSheet1'#7'Caption'#6#6'Sheet1'#12'ClientHeight'#3#227#0#11'Clien' + +'tWidth'#3't'#2#0#15'TsWorksheetGrid'#15'sWorksheetGrid1'#4'Left'#2#0#6'Heig' + +'ht'#3#227#0#3'Top'#2#0#5'Width'#3't'#2#10'FrozenCols'#2#0#10'FrozenRows'#2#0 + +#5'Align'#7#8'alClient'#8'ColCount'#2#2#14'ExtendedSelect'#8#7'Options'#11#15 + +'goFixedVertLine'#15'goFixedHorzLine'#10'goVertLine'#10'goHorzLine'#13'goRan' + +'geSelect'#11'goRowSizing'#11'goColSizing'#15'goThumbTracking'#14'goSmoothSc' + +'roll'#16'goFixedColSizing'#0#8'RowCount'#2#2#8'TabOrder'#2#0#10'TitleStyle' + +#7#8'tsNative'#12'OnSelectCell'#7#25'sWorksheetGrid1SelectCell'#9'ColWidths' + +#1#2'*'#2'@'#0#0#0#0#0#8'TToolBar'#8'ToolBar1'#4'Left'#2#0#6'Height'#2#26#3 + +'Top'#2#0#5'Width'#3'|'#2#12'ButtonHeight'#2#24#7'Caption'#6#8'ToolBar1'#11 + +'EdgeBorders'#11#0#6'Images'#7#10'ImageList1'#8'TabOrder'#2#2#0#11'TToolButt' + +'on'#11'ToolButton1'#4'Left'#2#1#3'Top'#2#0#6'Action'#7#6'AcOpen'#0#0#11'TTo' + +'olButton'#11'ToolButton2'#4'Left'#2#24#3'Top'#2#0#6'Action'#7#8'AcSaveAs'#0 + +#0#11'TToolButton'#11'ToolButton3'#4'Left'#2'P'#3'Top'#2#0#6'Action'#7#6'AcQ' + +'uit'#0#0#11'TToolButton'#11'ToolButton5'#4'Left'#2'/'#3'Top'#2#0#5'Width'#2 + +#5#7'Caption'#6#11'ToolButton5'#5'Style'#7#10'tbsDivider'#0#0#11'TToolButton' + +#11'ToolButton4'#4'Left'#2'4'#3'Top'#2#0#6'Action'#7#6'AcEdit'#0#0#11'TToolB' + +'utton'#11'ToolButton6'#4'Left'#2'K'#3'Top'#2#0#5'Width'#2#5#7'Caption'#6#11 + +'ToolButton6'#5'Style'#7#10'tbsDivider'#0#0#0#8'TToolBar'#13'FormatToolBar'#4 + +'Left'#2#0#3'Top'#2#26#5'Width'#3'|'#2#12'ButtonHeight'#2#28#7'Caption'#6#13 + +'FormatToolBar'#6'Images'#7#10'ImageList1'#8'TabOrder'#2#3#0#11'TToolButton' + +#12'ToolButton10'#4'Left'#3#17#1#3'Top'#2#2#6'Action'#7#11'AcLeftAlign'#0#0 + +#11'TToolButton'#12'ToolButton12'#4'Left'#3'('#1#3'Top'#2#2#6'Action'#7#16'A' + +'cHorCenterAlign'#0#0#11'TToolButton'#12'ToolButton13'#4'Left'#3'?'#1#3'Top' + +#2#2#6'Action'#7#12'AcRightAlign'#0#0#9'TComboBox'#12'FontComboBox'#4'Left'#2 + +#1#6'Height'#2#23#3'Top'#2#2#5'Width'#2#127#10'ItemHeight'#2#15#8'OnSelect'#7 + +#18'FontComboBoxSelect'#8'TabOrder'#2#0#0#0#9'TComboBox'#16'FontSizeComboBox' + +#4'Left'#3#128#0#6'Height'#2#23#3'Top'#2#2#5'Width'#2'0'#10'ItemHeight'#2#15 + +#13'Items.Strings'#1#6#1'8'#6#1'9'#6#2'10'#6#2'11'#6#2'12'#6#2'14'#6#2'16'#6 + +#2'18'#6#2'20'#6#2'24'#0#8'OnSelect'#7#18'FontComboBoxSelect'#8'TabOrder'#2#1 + +#0#0#11'TToolButton'#11'ToolButton7'#4'Left'#3#176#0#3'Top'#2#2#6'Action'#7 + +#10'AcFontBold'#0#0#11'TToolButton'#11'ToolButton8'#4'Left'#3#199#0#3'Top'#2 + +#2#6'Action'#7#12'AcFontItalic'#0#0#11'TToolButton'#11'ToolButton9'#4'Left'#3 + +#222#0#3'Top'#2#2#6'Action'#7#15'AcFontUnderline'#0#0#11'TToolButton'#12'Too' + +'lButton11'#4'Left'#3#245#0#3'Top'#2#2#6'Action'#7#15'AcFontStrikeout'#0#0#11 + +'TToolButton'#12'ToolButton14'#4'Left'#3#12#1#3'Top'#2#2#5'Width'#2#5#7'Capt' + +'ion'#6#12'ToolButton14'#5'Style'#7#10'tbsDivider'#0#0#11'TToolButton'#12'To' + +'olButton15'#4'Left'#3'V'#1#3'Top'#2#2#5'Width'#2#5#7'Caption'#6#12'ToolButt' + +'on15'#5'Style'#7#10'tbsDivider'#0#0#11'TToolButton'#12'ToolButton16'#4'Left' + +#3'['#1#3'Top'#2#2#6'Action'#7#11'AcVAlignTop'#0#0#11'TToolButton'#12'ToolBu' + +'tton17'#4'Left'#3'r'#1#3'Top'#2#2#6'Action'#7#14'AcVAlignCenter'#0#0#11'TTo' + ,'olButton'#12'ToolButton18'#4'Left'#3#137#1#3'Top'#2#2#6'Action'#7#14'AcVAli' + +'gnBottom'#0#0#11'TToolButton'#12'ToolButton19'#4'Left'#3#160#1#3'Top'#2#2#5 + +'Width'#2#5#7'Caption'#6#12'ToolButton19'#5'Style'#7#10'tbsDivider'#0#0#11'T' + +'ToolButton'#12'ToolButton20'#4'Left'#3#165#1#3'Top'#2#2#6'Action'#7#12'AcBo' + +'rderLeft'#0#0#11'TToolButton'#12'ToolButton21'#4'Left'#3#188#1#3'Top'#2#2#6 +'Action'#7#11'AcBorderTop'#0#0#11'TToolButton'#12'ToolButton22'#4'Left'#3#211 +#1#3'Top'#2#2#6'Action'#7#14'AcBorderBottom'#0#0#11'TToolButton'#12'ToolButt' +'on23'#4'Left'#3#234#1#3'Top'#2#2#6'Action'#7#17'AcBorderBottomDbl'#0#0#11'T' diff --git a/components/fpspreadsheet/fpspreadsheet.pas b/components/fpspreadsheet/fpspreadsheet.pas index 0b0913103..a4fcfba20 100755 --- a/components/fpspreadsheet/fpspreadsheet.pas +++ b/components/fpspreadsheet/fpspreadsheet.pas @@ -330,9 +330,11 @@ type FTopPaneHeight: Integer; FOptions: TsSheetOptions; FOnChangeCell: TsCellEvent; + FOnChangeFont: TsCellEvent; procedure RemoveCallback(data, arg: pointer); protected procedure ChangedCell(ARow, ACol: Cardinal); + procedure ChangedFont(ARow, ACol: Cardinal); public Name: string; { Base methods } @@ -410,6 +412,7 @@ type property LeftPaneWidth: Integer read FLeftPaneWidth write FLeftPaneWidth; property TopPaneHeight: Integer read FTopPaneHeight write FTopPaneHeight; property OnChangeCell: TsCellEvent read FOnChangeCell write FOnChangeCell; + property OnChangeFont: TsCellEvent read FOnChangeFont write FOnChangeFont; end; @@ -870,6 +873,13 @@ begin if Assigned(FOnChangeCell) then FOnChangeCell(Self, ARow, ACol); end; +{ Is called whenever a font height changes. Event can be caught by the grid + to update the row height. } +procedure TsWorksheet.ChangedFont(ARow, ACol: Cardinal); +begin + if Assigned(FonChangeFont) then FOnChangeFont(Self, ARow, ACol); +end; + procedure TsWorksheet.CopyCell(AFromRow, AFromCol, AToRow, AToCol: Cardinal; AFromWorksheet: TsWorksheet); var @@ -1466,7 +1476,7 @@ begin if Result = -1 then result := FWorkbook.AddFont(AFontName, AFontSize, AFontStyle, AFontColor); lCell^.FontIndex := Result; - ChangedCell(ARow, ACol); + ChangedFont(ARow, ACol); end; procedure TsWorksheet.WriteFont(ARow, ACol: Cardinal; AFontIndex: Integer); @@ -1479,7 +1489,7 @@ begin lCell := GetCell(ARow, ACol); Include(lCell^.UsedFormattingFields, uffFont); lCell^.FontIndex := AFontIndex; - ChangedCell(ARow, ACol); + ChangedFont(ARow, ACol); end else raise Exception.Create(lpInvalidFontIndex); end; @@ -1532,7 +1542,7 @@ begin ACell := GetCell(ARow, ACol); Include(ACell^.UsedFormattingFields, uffTextRotation); ACell^.TextRotation := ARotation; - ChangedCell(ARow, ACol); + ChangedFont(ARow, ACol); end; procedure TsWorksheet.WriteUsedFormatting(ARow, ACol: Cardinal; diff --git a/components/fpspreadsheet/fpspreadsheetgrid.pas b/components/fpspreadsheet/fpspreadsheetgrid.pas index 10bac905c..1f32ea198 100644 --- a/components/fpspreadsheet/fpspreadsheetgrid.pas +++ b/components/fpspreadsheet/fpspreadsheetgrid.pas @@ -35,6 +35,7 @@ type function CalcColWidth(AWidth: Single): Integer; function CalcRowHeight(AHeight: Single): Integer; procedure ChangedCellHandler(ASender: TObject; ARow, ACol: Cardinal); + procedure ChangedFontHandler(ASender: TObject; ARow, ACol: Cardinal); function GetShowGridLines: Boolean; function GetShowHeaders: Boolean; procedure SetFrozenCols(AValue: Integer); @@ -51,6 +52,7 @@ type function GetCellHeight(ACol, ARow: Integer): Integer; function GetCellText(ACol, ARow: Integer): String; function GetEditText(ACol, ARow: Integer): String; override; + procedure HeaderSized(IsColumn: Boolean; index: Integer); override; procedure KeyDown(var Key : Word; Shift : TShiftState); override; procedure Loaded; override; procedure LoadFromWorksheet(AWorksheet: TsWorksheet); @@ -314,19 +316,21 @@ begin inc(FLockCount); end; -// Converts the column width, given in "characters", to pixels +// Converts the column width, given in "characters" of the default font, to pixels // All chars are assumed to have the same width defined by the "0". // Therefore, this calculation is only approximate. function TsCustomWorksheetGrid.CalcColWidth(AWidth: Single): Integer; var w0: Integer; begin + Convert_sFont_to_Font(FWorkbook.GetFont(0), Canvas.Font); w0 := Canvas.TextWidth('0'); Result := Round(AWidth * w0); end; { Finds the max cell height per row and uses this to define the RowHeights[]. - Returns DefaultRowHeight if the row does not contain any cells. } + Returns DefaultRowHeight if the row does not contain any cells. + ARow is a grid row index. } function TsCustomWorksheetGrid.CalcAutoRowHeight(ARow: Integer): Integer; var c: Integer; @@ -352,6 +356,26 @@ begin if FLockCount = 0 then Invalidate; end; +{ Handler for the event that the font has changed in a given cell. + As a consequence, the row height may have to be adapted. + Row/Col coordinates are in worksheet units here! } +procedure TsCustomWorksheetGrid.ChangedFontHandler(ASender: TObject; ARow, ACol: Cardinal); +var + h: Integer; + lRow: PRow; +begin + if (FWorksheet <> nil) then begin + lRow := FWorksheet.FindRow(ARow); + if lRow = nil then begin + // There is no row record --> row height changes according to font height + // Otherwise the row height would be fixed according to the value in the row record. + ARow := ARow + FHeaderCount; // convert row index to grid units + RowHeights[ARow] := CalcAutoRowHeight(ARow); + end; + Invalidate; + end; +end; + { Converts a spreadsheet font to a font used for painting (TCanvas.Font). } procedure TsCustomWorksheetGrid.Convert_sFont_to_Font(sFont: TsFont; AFont: TFont); begin @@ -880,7 +904,7 @@ begin end; -{ Returns the height (in pixels) of the cell at ACol/ARow. } +{ Returns the height (in pixels) of the cell at ACol/ARow (of the grid). } function TsCustomWorksheetGrid.GetCellHeight(ACol, ARow: Integer): Integer; var lCell: PCell; @@ -1009,16 +1033,46 @@ begin Result := FHeaderCount <> 0; end; +{ Calculates the index of the worksheet column that is displayed in the + given column of the grid. If the sheet headers are turned on, both numbers + differ by 1, otherwise they are equal. Saves an "if" in cases. } function TsCustomWorksheetGrid.GetWorksheetCol(AGridCol: Integer): cardinal; begin Result := AGridCol - FHeaderCount; end; +{ Calculates the index of the worksheet row that is displayed in the + given row of the grid. If the sheet headers are turned on, both numbers + differ by 1, otherwise they are equal. Save an "if" in cases. } function TsCustomWorksheetGrid.GetWorksheetRow(AGridRow: Integer): Cardinal; begin Result := AGridRow - FHeaderCount; end; +{ Column width or row heights have changed. Stores the new number in the + worksheet. } +procedure TsCustomWorksheetGrid.HeaderSized(IsColumn: Boolean; index: Integer); +var + w0: Integer; + h: Single; +begin + if FWorksheet = nil then + exit; + + Convert_sFont_to_Font(FWorkbook.GetFont(0), Canvas.Font); + if IsColumn then begin + // The grid's column width is in "pixels", the worksheet's column width is + // in "characters". + w0 := Canvas.TextWidth('0'); + FWorksheet.WriteColWidth(GetWorksheetCol(Index), ColWidths[Index] div w0); + end else begin + // The grid's row heights are in "pixels", the worksheet's row heights are + // in millimeters. + h := (RowHeights[Index] - 2*constCellPadding) / Screen.PixelsPerInch * 25.4; + FWorksheet.WriteRowHeight(GetWorksheetRow(Index), h); + end; +end; + { Catches the ESC key during editing in order to restore the old cell text } procedure TsCustomWorksheetGrid.KeyDown(var Key : Word; Shift : TShiftState); begin @@ -1034,8 +1088,8 @@ begin Setup; end; -{ Is called when editing starts. Stores the old text just in case the user - presses ESC to cancel editing. } +{ Is called when editing starts. Stores the old text just for the case that + the user presses ESC to cancel editing. } procedure TsCustomWorksheetGrid.SelectEditor; begin FOldEditText := GetCellText(Col, Row); @@ -1134,6 +1188,7 @@ begin FWorksheet := AWorksheet; if FWorksheet <> nil then begin FWorksheet.OnChangeCell := @ChangedCellHandler; + FWorksheet.OnChangeFont := @ChangedFontHandler; ShowHeaders := (soShowHeaders in FWorksheet.Options); ShowGridLines := (soShowGridLines in FWorksheet.Options); if (soHasFrozenPanes in FWorksheet.Options) then begin