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
This commit is contained in:
wp_xxyyzz
2014-09-24 11:17:43 +00:00
parent cb05f8873a
commit 2d7b4fc3c6
2 changed files with 49 additions and 30 deletions

View File

@ -4,7 +4,7 @@ object MainFrm: TMainFrm
Top = 258 Top = 258
Width = 884 Width = 884
Caption = 'spready' Caption = 'spready'
ClientHeight = 619 ClientHeight = 614
ClientWidth = 884 ClientWidth = 884
Menu = MainMenu Menu = MainMenu
OnActivate = FormActivate OnActivate = FormActivate
@ -14,7 +14,7 @@ object MainFrm: TMainFrm
object Panel1: TPanel object Panel1: TPanel
Left = 0 Left = 0
Height = 78 Height = 78
Top = 541 Top = 536
Width = 884 Width = 884
Align = alBottom Align = alBottom
BevelOuter = bvNone BevelOuter = bvNone
@ -23,7 +23,7 @@ object MainFrm: TMainFrm
TabOrder = 6 TabOrder = 6
object EdFrozenCols: TSpinEdit object EdFrozenCols: TSpinEdit
Left = 429 Left = 429
Height = 23 Height = 28
Top = 8 Top = 8
Width = 52 Width = 52
OnChange = EdFrozenColsChange OnChange = EdFrozenColsChange
@ -31,7 +31,7 @@ object MainFrm: TMainFrm
end end
object EdFrozenRows: TSpinEdit object EdFrozenRows: TSpinEdit
Left = 429 Left = 429
Height = 23 Height = 28
Top = 39 Top = 39
Width = 52 Width = 52
OnChange = EdFrozenRowsChange OnChange = EdFrozenRowsChange
@ -39,37 +39,37 @@ object MainFrm: TMainFrm
end end
object Label1: TLabel object Label1: TLabel
Left = 344 Left = 344
Height = 15 Height = 20
Top = 13 Top = 13
Width = 62 Width = 77
Caption = 'Frozen cols:' Caption = 'Frozen cols:'
FocusControl = EdFrozenCols FocusControl = EdFrozenCols
ParentColor = False ParentColor = False
end end
object Label2: TLabel object Label2: TLabel
Left = 344 Left = 344
Height = 15 Height = 20
Top = 40 Top = 40
Width = 66 Width = 82
Caption = 'Frozen rows:' Caption = 'Frozen rows:'
FocusControl = EdFrozenRows FocusControl = EdFrozenRows
ParentColor = False ParentColor = False
end end
object CbReadFormulas: TCheckBox object CbReadFormulas: TCheckBox
Left = 8 Left = 8
Height = 19 Height = 24
Top = 8 Top = 8
Width = 96 Width = 120
Caption = 'Read formulas' Caption = 'Read formulas'
OnChange = CbReadFormulasChange OnChange = CbReadFormulasChange
TabOrder = 0 TabOrder = 0
end end
object CbHeaderStyle: TComboBox object CbHeaderStyle: TComboBox
Left = 200 Left = 200
Height = 23 Height = 28
Top = 8 Top = 8
Width = 116 Width = 116
ItemHeight = 15 ItemHeight = 20
ItemIndex = 2 ItemIndex = 2
Items.Strings = ( Items.Strings = (
'Lazarus' 'Lazarus'
@ -83,18 +83,18 @@ object MainFrm: TMainFrm
end end
object CbAutoCalcFormulas: TCheckBox object CbAutoCalcFormulas: TCheckBox
Left = 8 Left = 8
Height = 19 Height = 24
Top = 32 Top = 32
Width = 128 Width = 158
Caption = 'Calculate on change' Caption = 'Calculate on change'
OnChange = CbAutoCalcFormulasChange OnChange = CbAutoCalcFormulasChange
TabOrder = 1 TabOrder = 1
end end
object CbTextOverflow: TCheckBox object CbTextOverflow: TCheckBox
Left = 8 Left = 8
Height = 19 Height = 24
Top = 56 Top = 56
Width = 91 Width = 114
Caption = 'Text overflow' Caption = 'Text overflow'
Checked = True Checked = True
OnChange = CbTextOverflowChange OnChange = CbTextOverflowChange
@ -206,19 +206,19 @@ object MainFrm: TMainFrm
end end
object FontComboBox: TComboBox object FontComboBox: TComboBox
Left = 52 Left = 52
Height = 23 Height = 28
Top = 2 Top = 2
Width = 127 Width = 127
ItemHeight = 15 ItemHeight = 20
OnSelect = FontComboBoxSelect OnSelect = FontComboBoxSelect
TabOrder = 0 TabOrder = 0
end end
object FontSizeComboBox: TComboBox object FontSizeComboBox: TComboBox
Left = 179 Left = 179
Height = 23 Height = 28
Top = 2 Top = 2
Width = 48 Width = 48
ItemHeight = 15 ItemHeight = 20
Items.Strings = ( Items.Strings = (
'8' '8'
'9' '9'
@ -392,7 +392,7 @@ object MainFrm: TMainFrm
end end
object InspectorSplitter: TSplitter object InspectorSplitter: TSplitter
Left = 648 Left = 648
Height = 462 Height = 457
Top = 79 Top = 79
Width = 5 Width = 5
Align = alRight Align = alRight
@ -400,7 +400,7 @@ object MainFrm: TMainFrm
end end
object InspectorPageControl: TPageControl object InspectorPageControl: TPageControl
Left = 653 Left = 653
Height = 462 Height = 457
Top = 79 Top = 79
Width = 231 Width = 231
ActivePage = PgCellValue ActivePage = PgCellValue
@ -410,11 +410,11 @@ object MainFrm: TMainFrm
OnChange = InspectorPageControlChange OnChange = InspectorPageControlChange
object PgCellValue: TTabSheet object PgCellValue: TTabSheet
Caption = 'Cell value' Caption = 'Cell value'
ClientHeight = 434 ClientHeight = 424
ClientWidth = 223 ClientWidth = 223
object CellInspector: TValueListEditor object CellInspector: TValueListEditor
Left = 0 Left = 0
Height = 434 Height = 424
Top = 0 Top = 0
Width = 223 Width = 223
Align = alClient Align = alClient
@ -452,10 +452,13 @@ object MainFrm: TMainFrm
object PgProperties: TTabSheet object PgProperties: TTabSheet
Caption = 'Properties' Caption = 'Properties'
end end
object PgSheet: TTabSheet
Caption = 'Sheet'
end
end end
object TabControl: TTabControl object TabControl: TTabControl
Left = 0 Left = 0
Height = 462 Height = 457
Top = 79 Top = 79
Width = 648 Width = 648
OnChange = TabControlChange OnChange = TabControlChange
@ -463,7 +466,7 @@ object MainFrm: TMainFrm
TabOrder = 3 TabOrder = 3
object WorksheetGrid: TsWorksheetGrid object WorksheetGrid: TsWorksheetGrid
Left = 2 Left = 2
Height = 457 Height = 452
Top = 3 Top = 3
Width = 644 Width = 644
FrozenCols = 0 FrozenCols = 0
@ -480,7 +483,7 @@ object MainFrm: TMainFrm
TitleStyle = tsNative TitleStyle = tsNative
OnSelection = WorksheetGridSelection OnSelection = WorksheetGridSelection
ColWidths = ( ColWidths = (
42 56
64 64
64 64
64 64

View File

@ -223,6 +223,7 @@ type
PgCellValue: TTabSheet; PgCellValue: TTabSheet;
PgProperties: TTabSheet; PgProperties: TTabSheet;
TabControl: TTabControl; TabControl: TTabControl;
PgSheet: TTabSheet;
ToolButton22: TToolButton; ToolButton22: TToolButton;
ToolButton23: TToolButton; ToolButton23: TToolButton;
ToolButton27: TToolButton; ToolButton27: TToolButton;
@ -873,9 +874,6 @@ begin
// Initialize a new empty workbook // Initialize a new empty workbook
AcNewExecute(nil); AcNewExecute(nil);
// Initialize Inspector
//UpdateCellInfo(nil);
ActiveControl := WorksheetGrid; ActiveControl := WorksheetGrid;
end; end;
@ -945,6 +943,7 @@ end;
procedure TMainFrm.TabControlChange(Sender: TObject); procedure TMainFrm.TabControlChange(Sender: TObject);
begin begin
WorksheetGrid.SelectSheetByIndex(TabControl.TabIndex); WorksheetGrid.SelectSheetByIndex(TabControl.TabIndex);
WorksheetGridSelection(self, WorksheetGrid.Col, WorksheetGrid.Row);
end; end;
procedure TMainFrm.UpdateBackgroundColorIndex; procedure TMainFrm.UpdateBackgroundColorIndex;
@ -1019,6 +1018,23 @@ begin
ACell^.SharedFormulaBase^.Row, ACell^.SharedFormulaBase^.Col)])); ACell^.SharedFormulaBase^.Row, ACell^.SharedFormulaBase^.Col)]));
end end
else 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 begin
if (ACell=nil) or not (uffFont in ACell^.UsedFormattingFields) if (ACell=nil) or not (uffFont in ACell^.UsedFormattingFields)
then Strings.Add('FontIndex=') then Strings.Add('FontIndex=')