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
|
||||
TitleStyle = tsNative
|
||||
ColWidths = (
|
||||
42
|
||||
56
|
||||
64
|
||||
64
|
||||
64
|
||||
@ -104,19 +104,19 @@ object Form1: TForm1
|
||||
TabOrder = 2
|
||||
object Label1: TLabel
|
||||
Left = 8
|
||||
Height = 15
|
||||
Height = 20
|
||||
Top = 9
|
||||
Width = 37
|
||||
Width = 46
|
||||
Caption = 'Sheets:'
|
||||
ParentColor = False
|
||||
end
|
||||
object SheetsCombo: TComboBox
|
||||
Left = 72
|
||||
Height = 23
|
||||
Height = 28
|
||||
Top = 4
|
||||
Width = 808
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
ItemHeight = 15
|
||||
ItemHeight = 20
|
||||
ItemIndex = 0
|
||||
Items.Strings = (
|
||||
'Sheet 1'
|
||||
|
@ -109,6 +109,8 @@ end;
|
||||
|
||||
// Saves sheet in grid to file, overwriting existing file
|
||||
procedure TForm1.BtnSaveClick(Sender: TObject);
|
||||
var
|
||||
err: String;
|
||||
begin
|
||||
if WorksheetGrid.Workbook = nil then
|
||||
exit;
|
||||
@ -120,6 +122,10 @@ begin
|
||||
WorksheetGrid.SaveToSpreadsheetFile(SaveDialog.FileName);
|
||||
finally
|
||||
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;
|
||||
@ -131,6 +137,8 @@ end;
|
||||
|
||||
// Loads first worksheet from file into grid
|
||||
procedure TForm1.LoadFile(const AFileName: String);
|
||||
var
|
||||
err: String;
|
||||
begin
|
||||
// Load file
|
||||
Screen.Cursor := crHourglass;
|
||||
@ -147,9 +155,13 @@ begin
|
||||
WorksheetGrid.GetSheets(SheetsCombo.Items);
|
||||
SheetsCombo.ItemIndex := 0;
|
||||
|
||||
// WorksheetGridSelection(nil, WorksheetGrid.Col, WorksheetGrid.Row);
|
||||
finally
|
||||
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;
|
||||
|
||||
|
@ -4,7 +4,7 @@ object Form1: TForm1
|
||||
Top = 258
|
||||
Width = 884
|
||||
Caption = 'spready'
|
||||
ClientHeight = 619
|
||||
ClientHeight = 614
|
||||
ClientWidth = 884
|
||||
Menu = MainMenu
|
||||
OnActivate = FormActivate
|
||||
@ -14,7 +14,7 @@ object Form1: TForm1
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Height = 85
|
||||
Top = 534
|
||||
Top = 529
|
||||
Width = 884
|
||||
Align = alBottom
|
||||
BevelOuter = bvNone
|
||||
@ -23,9 +23,9 @@ object Form1: TForm1
|
||||
TabOrder = 0
|
||||
object CbShowHeaders: TCheckBox
|
||||
Left = 8
|
||||
Height = 19
|
||||
Height = 24
|
||||
Top = 8
|
||||
Width = 93
|
||||
Width = 116
|
||||
Caption = 'Show headers'
|
||||
Checked = True
|
||||
OnClick = CbShowHeadersClick
|
||||
@ -34,9 +34,9 @@ object Form1: TForm1
|
||||
end
|
||||
object CbShowGridLines: TCheckBox
|
||||
Left = 8
|
||||
Height = 19
|
||||
Height = 24
|
||||
Top = 32
|
||||
Width = 100
|
||||
Width = 125
|
||||
Caption = 'Show grid lines'
|
||||
Checked = True
|
||||
OnClick = CbShowGridLinesClick
|
||||
@ -45,7 +45,7 @@ object Form1: TForm1
|
||||
end
|
||||
object EdFrozenCols: TSpinEdit
|
||||
Left = 389
|
||||
Height = 23
|
||||
Height = 28
|
||||
Top = 8
|
||||
Width = 52
|
||||
OnChange = EdFrozenColsChange
|
||||
@ -53,7 +53,7 @@ object Form1: TForm1
|
||||
end
|
||||
object EdFrozenRows: TSpinEdit
|
||||
Left = 389
|
||||
Height = 23
|
||||
Height = 28
|
||||
Top = 39
|
||||
Width = 52
|
||||
OnChange = EdFrozenRowsChange
|
||||
@ -61,37 +61,37 @@ object Form1: TForm1
|
||||
end
|
||||
object Label1: TLabel
|
||||
Left = 304
|
||||
Height = 15
|
||||
Height = 20
|
||||
Top = 13
|
||||
Width = 62
|
||||
Width = 77
|
||||
Caption = 'Frozen cols:'
|
||||
FocusControl = EdFrozenCols
|
||||
ParentColor = False
|
||||
end
|
||||
object Label2: TLabel
|
||||
Left = 304
|
||||
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 = 56
|
||||
Width = 96
|
||||
Width = 120
|
||||
Caption = 'Read formulas'
|
||||
OnChange = CbReadFormulasChange
|
||||
TabOrder = 4
|
||||
end
|
||||
object CbHeaderStyle: TComboBox
|
||||
Left = 152
|
||||
Height = 23
|
||||
Height = 28
|
||||
Top = 8
|
||||
Width = 116
|
||||
ItemHeight = 15
|
||||
ItemHeight = 20
|
||||
ItemIndex = 2
|
||||
Items.Strings = (
|
||||
'Lazarus'
|
||||
@ -106,7 +106,7 @@ object Form1: TForm1
|
||||
end
|
||||
object PageControl1: TPageControl
|
||||
Left = 0
|
||||
Height = 455
|
||||
Height = 450
|
||||
Top = 79
|
||||
Width = 884
|
||||
ActivePage = TabSheet1
|
||||
@ -116,11 +116,11 @@ object Form1: TForm1
|
||||
OnChange = PageControl1Change
|
||||
object TabSheet1: TTabSheet
|
||||
Caption = 'Sheet1'
|
||||
ClientHeight = 427
|
||||
ClientHeight = 417
|
||||
ClientWidth = 876
|
||||
object WorksheetGrid: TsWorksheetGrid
|
||||
Left = 0
|
||||
Height = 427
|
||||
Height = 417
|
||||
Top = 0
|
||||
Width = 876
|
||||
FrozenCols = 0
|
||||
@ -136,7 +136,7 @@ object Form1: TForm1
|
||||
TitleStyle = tsNative
|
||||
OnSelection = WorksheetGridSelection
|
||||
ColWidths = (
|
||||
42
|
||||
56
|
||||
64
|
||||
64
|
||||
64
|
||||
@ -254,19 +254,19 @@ object Form1: TForm1
|
||||
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'
|
||||
|
@ -641,6 +641,8 @@ end;
|
||||
|
||||
procedure TForm1.acSaveAsExecute(Sender: TObject);
|
||||
// Saves sheet in grid to file, overwriting existing file
|
||||
var
|
||||
err: String = '';
|
||||
begin
|
||||
if WorksheetGrid.Workbook = nil then
|
||||
exit;
|
||||
@ -652,6 +654,9 @@ begin
|
||||
WorksheetGrid.SaveToSpreadsheetFile(SaveDialog.FileName);
|
||||
finally
|
||||
Screen.Cursor := crDefault;
|
||||
err := WorksheetGrid.Workbook.ErrorMsg;
|
||||
if err <> '' then
|
||||
MessageDlg(err, mtError, [mbOK], 0);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -765,6 +770,7 @@ procedure TForm1.LoadFile(const AFileName: String);
|
||||
var
|
||||
pages: TStrings;
|
||||
i: Integer;
|
||||
err: String;
|
||||
begin
|
||||
// Load file
|
||||
Screen.Cursor := crHourglass;
|
||||
@ -797,8 +803,13 @@ begin
|
||||
end;
|
||||
|
||||
WorksheetGridSelection(nil, WorksheetGrid.Col, WorksheetGrid.Row);
|
||||
|
||||
finally
|
||||
Screen.Cursor := crDefault;
|
||||
|
||||
err := WorksheetGrid.Workbook.ErrorMsg;
|
||||
if err <> '' then
|
||||
MessageDlg(err, mtError, [mbOK], 0);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Reference in New Issue
Block a user