You've already forked lazarus-ccr
fpspreadsheet: Show error messages after reading/writing in the "fpsgrid" and "spready" demos.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3469 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -63,7 +63,7 @@ object Form1: TForm1
|
|||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
TitleStyle = tsNative
|
TitleStyle = tsNative
|
||||||
ColWidths = (
|
ColWidths = (
|
||||||
42
|
56
|
||||||
64
|
64
|
||||||
64
|
64
|
||||||
64
|
64
|
||||||
@ -104,19 +104,19 @@ object Form1: TForm1
|
|||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
object Label1: TLabel
|
object Label1: TLabel
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 15
|
Height = 20
|
||||||
Top = 9
|
Top = 9
|
||||||
Width = 37
|
Width = 46
|
||||||
Caption = 'Sheets:'
|
Caption = 'Sheets:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object SheetsCombo: TComboBox
|
object SheetsCombo: TComboBox
|
||||||
Left = 72
|
Left = 72
|
||||||
Height = 23
|
Height = 28
|
||||||
Top = 4
|
Top = 4
|
||||||
Width = 808
|
Width = 808
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
ItemHeight = 15
|
ItemHeight = 20
|
||||||
ItemIndex = 0
|
ItemIndex = 0
|
||||||
Items.Strings = (
|
Items.Strings = (
|
||||||
'Sheet 1'
|
'Sheet 1'
|
||||||
|
@ -109,6 +109,8 @@ end;
|
|||||||
|
|
||||||
// Saves sheet in grid to file, overwriting existing file
|
// Saves sheet in grid to file, overwriting existing file
|
||||||
procedure TForm1.BtnSaveClick(Sender: TObject);
|
procedure TForm1.BtnSaveClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
err: String;
|
||||||
begin
|
begin
|
||||||
if WorksheetGrid.Workbook = nil then
|
if WorksheetGrid.Workbook = nil then
|
||||||
exit;
|
exit;
|
||||||
@ -120,6 +122,10 @@ begin
|
|||||||
WorksheetGrid.SaveToSpreadsheetFile(SaveDialog.FileName);
|
WorksheetGrid.SaveToSpreadsheetFile(SaveDialog.FileName);
|
||||||
finally
|
finally
|
||||||
Screen.Cursor := crDefault;
|
Screen.Cursor := crDefault;
|
||||||
|
// Show a message in case of error(s)
|
||||||
|
err := WorksheetGrid.Workbook.ErrorMsg;
|
||||||
|
if err <> '' then
|
||||||
|
MessageDlg(err, mtError, [mbOK], 0);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -131,6 +137,8 @@ end;
|
|||||||
|
|
||||||
// Loads first worksheet from file into grid
|
// Loads first worksheet from file into grid
|
||||||
procedure TForm1.LoadFile(const AFileName: String);
|
procedure TForm1.LoadFile(const AFileName: String);
|
||||||
|
var
|
||||||
|
err: String;
|
||||||
begin
|
begin
|
||||||
// Load file
|
// Load file
|
||||||
Screen.Cursor := crHourglass;
|
Screen.Cursor := crHourglass;
|
||||||
@ -147,9 +155,13 @@ begin
|
|||||||
WorksheetGrid.GetSheets(SheetsCombo.Items);
|
WorksheetGrid.GetSheets(SheetsCombo.Items);
|
||||||
SheetsCombo.ItemIndex := 0;
|
SheetsCombo.ItemIndex := 0;
|
||||||
|
|
||||||
// WorksheetGridSelection(nil, WorksheetGrid.Col, WorksheetGrid.Row);
|
|
||||||
finally
|
finally
|
||||||
Screen.Cursor := crDefault;
|
Screen.Cursor := crDefault;
|
||||||
|
|
||||||
|
// Show a message in case of error(s)
|
||||||
|
err := WorksheetGrid.Workbook.ErrorMsg;
|
||||||
|
if err <> '' then
|
||||||
|
MessageDlg(err, mtError, [mbOK], 0);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ object Form1: TForm1
|
|||||||
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 Form1: TForm1
|
|||||||
object Panel1: TPanel
|
object Panel1: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 85
|
Height = 85
|
||||||
Top = 534
|
Top = 529
|
||||||
Width = 884
|
Width = 884
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
@ -23,9 +23,9 @@ object Form1: TForm1
|
|||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object CbShowHeaders: TCheckBox
|
object CbShowHeaders: TCheckBox
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 19
|
Height = 24
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 93
|
Width = 116
|
||||||
Caption = 'Show headers'
|
Caption = 'Show headers'
|
||||||
Checked = True
|
Checked = True
|
||||||
OnClick = CbShowHeadersClick
|
OnClick = CbShowHeadersClick
|
||||||
@ -34,9 +34,9 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object CbShowGridLines: TCheckBox
|
object CbShowGridLines: TCheckBox
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 19
|
Height = 24
|
||||||
Top = 32
|
Top = 32
|
||||||
Width = 100
|
Width = 125
|
||||||
Caption = 'Show grid lines'
|
Caption = 'Show grid lines'
|
||||||
Checked = True
|
Checked = True
|
||||||
OnClick = CbShowGridLinesClick
|
OnClick = CbShowGridLinesClick
|
||||||
@ -45,7 +45,7 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object EdFrozenCols: TSpinEdit
|
object EdFrozenCols: TSpinEdit
|
||||||
Left = 389
|
Left = 389
|
||||||
Height = 23
|
Height = 28
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 52
|
Width = 52
|
||||||
OnChange = EdFrozenColsChange
|
OnChange = EdFrozenColsChange
|
||||||
@ -53,7 +53,7 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object EdFrozenRows: TSpinEdit
|
object EdFrozenRows: TSpinEdit
|
||||||
Left = 389
|
Left = 389
|
||||||
Height = 23
|
Height = 28
|
||||||
Top = 39
|
Top = 39
|
||||||
Width = 52
|
Width = 52
|
||||||
OnChange = EdFrozenRowsChange
|
OnChange = EdFrozenRowsChange
|
||||||
@ -61,37 +61,37 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object Label1: TLabel
|
object Label1: TLabel
|
||||||
Left = 304
|
Left = 304
|
||||||
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 = 304
|
Left = 304
|
||||||
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 = 56
|
Top = 56
|
||||||
Width = 96
|
Width = 120
|
||||||
Caption = 'Read formulas'
|
Caption = 'Read formulas'
|
||||||
OnChange = CbReadFormulasChange
|
OnChange = CbReadFormulasChange
|
||||||
TabOrder = 4
|
TabOrder = 4
|
||||||
end
|
end
|
||||||
object CbHeaderStyle: TComboBox
|
object CbHeaderStyle: TComboBox
|
||||||
Left = 152
|
Left = 152
|
||||||
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'
|
||||||
@ -106,7 +106,7 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object PageControl1: TPageControl
|
object PageControl1: TPageControl
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 455
|
Height = 450
|
||||||
Top = 79
|
Top = 79
|
||||||
Width = 884
|
Width = 884
|
||||||
ActivePage = TabSheet1
|
ActivePage = TabSheet1
|
||||||
@ -116,11 +116,11 @@ object Form1: TForm1
|
|||||||
OnChange = PageControl1Change
|
OnChange = PageControl1Change
|
||||||
object TabSheet1: TTabSheet
|
object TabSheet1: TTabSheet
|
||||||
Caption = 'Sheet1'
|
Caption = 'Sheet1'
|
||||||
ClientHeight = 427
|
ClientHeight = 417
|
||||||
ClientWidth = 876
|
ClientWidth = 876
|
||||||
object WorksheetGrid: TsWorksheetGrid
|
object WorksheetGrid: TsWorksheetGrid
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 427
|
Height = 417
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 876
|
Width = 876
|
||||||
FrozenCols = 0
|
FrozenCols = 0
|
||||||
@ -136,7 +136,7 @@ object Form1: TForm1
|
|||||||
TitleStyle = tsNative
|
TitleStyle = tsNative
|
||||||
OnSelection = WorksheetGridSelection
|
OnSelection = WorksheetGridSelection
|
||||||
ColWidths = (
|
ColWidths = (
|
||||||
42
|
56
|
||||||
64
|
64
|
||||||
64
|
64
|
||||||
64
|
64
|
||||||
@ -254,19 +254,19 @@ object Form1: TForm1
|
|||||||
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'
|
||||||
|
@ -641,6 +641,8 @@ end;
|
|||||||
|
|
||||||
procedure TForm1.acSaveAsExecute(Sender: TObject);
|
procedure TForm1.acSaveAsExecute(Sender: TObject);
|
||||||
// Saves sheet in grid to file, overwriting existing file
|
// Saves sheet in grid to file, overwriting existing file
|
||||||
|
var
|
||||||
|
err: String = '';
|
||||||
begin
|
begin
|
||||||
if WorksheetGrid.Workbook = nil then
|
if WorksheetGrid.Workbook = nil then
|
||||||
exit;
|
exit;
|
||||||
@ -652,6 +654,9 @@ begin
|
|||||||
WorksheetGrid.SaveToSpreadsheetFile(SaveDialog.FileName);
|
WorksheetGrid.SaveToSpreadsheetFile(SaveDialog.FileName);
|
||||||
finally
|
finally
|
||||||
Screen.Cursor := crDefault;
|
Screen.Cursor := crDefault;
|
||||||
|
err := WorksheetGrid.Workbook.ErrorMsg;
|
||||||
|
if err <> '' then
|
||||||
|
MessageDlg(err, mtError, [mbOK], 0);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -765,6 +770,7 @@ procedure TForm1.LoadFile(const AFileName: String);
|
|||||||
var
|
var
|
||||||
pages: TStrings;
|
pages: TStrings;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
err: String;
|
||||||
begin
|
begin
|
||||||
// Load file
|
// Load file
|
||||||
Screen.Cursor := crHourglass;
|
Screen.Cursor := crHourglass;
|
||||||
@ -797,8 +803,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
WorksheetGridSelection(nil, WorksheetGrid.Col, WorksheetGrid.Row);
|
WorksheetGridSelection(nil, WorksheetGrid.Col, WorksheetGrid.Row);
|
||||||
|
|
||||||
finally
|
finally
|
||||||
Screen.Cursor := crDefault;
|
Screen.Cursor := crDefault;
|
||||||
|
|
||||||
|
err := WorksheetGrid.Workbook.ErrorMsg;
|
||||||
|
if err <> '' then
|
||||||
|
MessageDlg(err, mtError, [mbOK], 0);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user