From 2d7b4fc3c6a656fad3dbd6aa9bc2f9df739ab0c1 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Wed, 24 Sep 2014 11:17:43 +0000 Subject: [PATCH] fpspreadsheet: Extend "inspector" page in "spready" demo to show information on the selected worksheet of the loaded workbook. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3601 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../examples/spready/mainform.lfm | 57 ++++++++++--------- .../examples/spready/mainform.pas | 22 ++++++- 2 files changed, 49 insertions(+), 30 deletions(-) diff --git a/components/fpspreadsheet/examples/spready/mainform.lfm b/components/fpspreadsheet/examples/spready/mainform.lfm index a49f41f31..e3e027e5a 100644 --- a/components/fpspreadsheet/examples/spready/mainform.lfm +++ b/components/fpspreadsheet/examples/spready/mainform.lfm @@ -4,7 +4,7 @@ object MainFrm: TMainFrm Top = 258 Width = 884 Caption = 'spready' - ClientHeight = 619 + ClientHeight = 614 ClientWidth = 884 Menu = MainMenu OnActivate = FormActivate @@ -14,7 +14,7 @@ object MainFrm: TMainFrm object Panel1: TPanel Left = 0 Height = 78 - Top = 541 + Top = 536 Width = 884 Align = alBottom BevelOuter = bvNone @@ -23,7 +23,7 @@ object MainFrm: TMainFrm TabOrder = 6 object EdFrozenCols: TSpinEdit Left = 429 - Height = 23 + Height = 28 Top = 8 Width = 52 OnChange = EdFrozenColsChange @@ -31,7 +31,7 @@ object MainFrm: TMainFrm end object EdFrozenRows: TSpinEdit Left = 429 - Height = 23 + Height = 28 Top = 39 Width = 52 OnChange = EdFrozenRowsChange @@ -39,37 +39,37 @@ object MainFrm: TMainFrm end object Label1: TLabel Left = 344 - Height = 15 + Height = 20 Top = 13 - Width = 62 + Width = 77 Caption = 'Frozen cols:' FocusControl = EdFrozenCols ParentColor = False end object Label2: TLabel Left = 344 - Height = 15 + Height = 20 Top = 40 - Width = 66 + Width = 82 Caption = 'Frozen rows:' FocusControl = EdFrozenRows ParentColor = False end object CbReadFormulas: TCheckBox Left = 8 - Height = 19 + Height = 24 Top = 8 - Width = 96 + Width = 120 Caption = 'Read formulas' OnChange = CbReadFormulasChange TabOrder = 0 end object CbHeaderStyle: TComboBox Left = 200 - Height = 23 + Height = 28 Top = 8 Width = 116 - ItemHeight = 15 + ItemHeight = 20 ItemIndex = 2 Items.Strings = ( 'Lazarus' @@ -83,18 +83,18 @@ object MainFrm: TMainFrm end object CbAutoCalcFormulas: TCheckBox Left = 8 - Height = 19 + Height = 24 Top = 32 - Width = 128 + Width = 158 Caption = 'Calculate on change' OnChange = CbAutoCalcFormulasChange TabOrder = 1 end object CbTextOverflow: TCheckBox Left = 8 - Height = 19 + Height = 24 Top = 56 - Width = 91 + Width = 114 Caption = 'Text overflow' Checked = True OnChange = CbTextOverflowChange @@ -206,19 +206,19 @@ object MainFrm: TMainFrm end object FontComboBox: TComboBox Left = 52 - Height = 23 + Height = 28 Top = 2 Width = 127 - ItemHeight = 15 + ItemHeight = 20 OnSelect = FontComboBoxSelect TabOrder = 0 end object FontSizeComboBox: TComboBox Left = 179 - Height = 23 + Height = 28 Top = 2 Width = 48 - ItemHeight = 15 + ItemHeight = 20 Items.Strings = ( '8' '9' @@ -392,7 +392,7 @@ object MainFrm: TMainFrm end object InspectorSplitter: TSplitter Left = 648 - Height = 462 + Height = 457 Top = 79 Width = 5 Align = alRight @@ -400,7 +400,7 @@ object MainFrm: TMainFrm end object InspectorPageControl: TPageControl Left = 653 - Height = 462 + Height = 457 Top = 79 Width = 231 ActivePage = PgCellValue @@ -410,11 +410,11 @@ object MainFrm: TMainFrm OnChange = InspectorPageControlChange object PgCellValue: TTabSheet Caption = 'Cell value' - ClientHeight = 434 + ClientHeight = 424 ClientWidth = 223 object CellInspector: TValueListEditor Left = 0 - Height = 434 + Height = 424 Top = 0 Width = 223 Align = alClient @@ -452,10 +452,13 @@ object MainFrm: TMainFrm object PgProperties: TTabSheet Caption = 'Properties' end + object PgSheet: TTabSheet + Caption = 'Sheet' + end end object TabControl: TTabControl Left = 0 - Height = 462 + Height = 457 Top = 79 Width = 648 OnChange = TabControlChange @@ -463,7 +466,7 @@ object MainFrm: TMainFrm TabOrder = 3 object WorksheetGrid: TsWorksheetGrid Left = 2 - Height = 457 + Height = 452 Top = 3 Width = 644 FrozenCols = 0 @@ -480,7 +483,7 @@ object MainFrm: TMainFrm TitleStyle = tsNative OnSelection = WorksheetGridSelection ColWidths = ( - 42 + 56 64 64 64 diff --git a/components/fpspreadsheet/examples/spready/mainform.pas b/components/fpspreadsheet/examples/spready/mainform.pas index d648a33f4..84fa211de 100644 --- a/components/fpspreadsheet/examples/spready/mainform.pas +++ b/components/fpspreadsheet/examples/spready/mainform.pas @@ -223,6 +223,7 @@ type PgCellValue: TTabSheet; PgProperties: TTabSheet; TabControl: TTabControl; + PgSheet: TTabSheet; ToolButton22: TToolButton; ToolButton23: TToolButton; ToolButton27: TToolButton; @@ -873,9 +874,6 @@ begin // Initialize a new empty workbook AcNewExecute(nil); - // Initialize Inspector - //UpdateCellInfo(nil); - ActiveControl := WorksheetGrid; end; @@ -945,6 +943,7 @@ end; procedure TMainFrm.TabControlChange(Sender: TObject); begin WorksheetGrid.SelectSheetByIndex(TabControl.TabIndex); + WorksheetGridSelection(self, WorksheetGrid.Col, WorksheetGrid.Row); end; procedure TMainFrm.UpdateBackgroundColorIndex; @@ -1019,6 +1018,23 @@ begin ACell^.SharedFormulaBase^.Row, ACell^.SharedFormulaBase^.Col)])); end else + if InspectorPageControl.ActivePage = PgSheet then + begin + if WorksheetGrid.Worksheet = nil then + begin + Strings.Add('First row='); + Strings.Add('Last row='); + Strings.Add('First column='); + Strings.Add('Last column='); + end else + begin + Strings.Add(Format('First row=%d', [WorksheetGrid.Worksheet.GetFirstRowIndex])); + Strings.Add(Format('Last row=%d', [WorksheetGrid.Worksheet.GetLastRowIndex])); + Strings.Add(Format('First column=%d', [WorksheetGrid.Worksheet.GetFirstColIndex])); + Strings.Add(Format('Last column=%d', [WorksheetGrid.Worksheet.GetLastColIndex])); + end; + end + else begin if (ACell=nil) or not (uffFont in ACell^.UsedFormattingFields) then Strings.Add('FontIndex=')