Files
lazarus-ccr/components/fpspreadsheet/examples/visual/fpschart/worksheetchartsource/mainform.pas
wp_xxyyzz 5b946b751f fpspreadsheet: Add units (mm, cm, in, pts, lines/chars) for column width and row heights. Update all demos (some issues left).
NOTE: This revision breaks existing code if the worksheet's DefaultRowHeight/DefaultColWidth is changed - value must be in millimeters now. Methods for accessing individual row heiths and column widths are fine, but are marked as deprecated, they use the old units. Optionally a unit parameter can be specified.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4568 8e941d3f-bd1b-0410-a28a-d453659cc2b4
2016-03-18 19:50:40 +00:00

76 lines
1.8 KiB
ObjectPascal

unit mainform;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, EditBtn, ExtCtrls,
fpspreadsheetchart, fpspreadsheetgrid,
TAGraph, TASeries;
type
{ TFPSChartForm }
TFPSChartForm = class(TForm)
Bevel1: TBevel;
btnCreateGraphic: TButton;
btnLoadSpreadsheet: TButton;
editSourceFile: TFileNameEdit;
Label1: TLabel;
Label2: TLabel;
editXAxis: TLabeledEdit;
EditYAxis: TLabeledEdit;
MyChart: TChart;
FPSChartSource: TsWorksheetChartSource;
MyChartBarSeries1: TBarSeries;
WorksheetGrid: TsWorksheetGrid;
procedure btnCreateGraphicClick(Sender: TObject);
procedure btnLoadSpreadsheetClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
FPSChartForm: TFPSChartForm;
implementation
uses
// FPSpreadsheet and supported formats
fpspreadsheet, xlsbiff8, xlsbiff5, xlsbiff2, xlsxooxml, fpsopendocument;
{$R *.lfm}
{ TFPSChartForm }
procedure TFPSChartForm.btnCreateGraphicClick(Sender: TObject);
begin
FPSChartSource.LoadPropertiesFromStrings(editXAxis.Text, editYAxis.Text, '', '', '');
FPSChartSource.LoadFromWorksheetGrid(WorksheetGrid);
end;
procedure TFPSChartForm.btnLoadSpreadsheetClick(Sender: TObject);
begin
WorksheetGrid.LoadFromSpreadsheetFile(editSourceFile.Text);
end;
procedure TFPSChartForm.FormCreate(Sender: TObject);
begin
editSourceFile.InitialDir := ExtractFilePath(ParamStr(0));
// Property Text is not published in older versions of Lazarus
editSourceFile.Text := 't1.xls';
end;
initialization
// Property Text is not published in older versions of Lazarus
RegisterPropertyToSkip(TFileNameEdit, 'Text', 'Not used in Laz 1.0', '');
end.