unit main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, WebComp, WebAdapt, dxSkinsCore, dxSkinBlack, dxSkinBlue,
dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide,
dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMoneyTwins,
dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black,
dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinPumpkin, dxSkinSeven,
dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus, dxSkinSilver,
dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld,
dxSkinsDefaultPainters, dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint,
dxSkinXmas2008Blue, cxLookAndFeels, cxGraphics, cxControls,
cxLookAndFeelPainters, dxSkinscxPCPainter, cxPCdxBarPopupMenu, cxPC,
cxContainer, cxEdit, Menus, StdCtrls, cxButtons, cxLabel, Gewichtsklassen,
ComCtrls, TeEngine, ExtCtrls, TeeProcs, Chart, Eingabe, WideStrings, FMTBcd,
DB, SqlExpr, DBTables, cxTextEdit;
type
TForm1 =
class(TForm)
cxPageControl1: TcxPageControl;
cxTabSheetDaten: TcxTabSheet;
TabSheetGewichtsverlauf: TcxTabSheet;
TabSheetUmfangsverlauf: TcxTabSheet;
Chart1: TChart;
Button1: TButton;
cxLabel1: TcxLabel;
cxLabel2: TcxLabel;
cxStartgew: TcxTextEdit;
cxZielgew: TcxTextEdit;
StringGrid1: TStringGrid;
Button2: TButton;
Timer1: TTimer;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
// FVerarbeitung: TVerarbeitung;
public
procedure LoadStringGridFromFile(AStringGrid: TStringGrid;
const AFileName:
String);
procedure SaveStringGridToFile(AStringGrid: TStringGrid;
const AFileName:
String);
// property Verarbeitung: TVerarbeitung read FVerarbeitung write FVerarbeitung;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
lForm: TForm2;
lStrList: TStringList;
i: Integer;
begin
lForm := TForm2.Create(
nil);
lStrList := TStringList.Create;
lForm.Verarbeitung.Gewicht.StartGew := StrToFloat(cxStartgew.Text);
lForm.Verarbeitung.Gewicht.ZielGew := StrToFloat(cxZielgew.Text);
with lForm
do
try
if ShowModal = mrOK
then
begin
lStrList.Add(FloatToStr(Verarbeitung.Gewicht.NewGew)+ '
,' + FloatToStr(Verarbeitung.Umfang.Taille) + '
,' +
FloatToStr(Verarbeitung.Umfang.Huefte) + '
,' + FloatToStr(Verarbeitung.Umfang.SchenkelGes)
+ '
,' + FloatToStr(Verarbeitung.ProzTarget)
{ + FloatToStr(Verarbeitung.NewBMI)});
StringGrid1.Rows[2].Add(lStrList.CommaText)
// LMyObj := TMyObj.Create;
// StoreToObj( LMyObj ); // Methode des Eingabeformulars TDataEditForm
// MyList.Add( LMyObj );
// SaveListToFile( MyList );
// ListToStringGrid( MyList, StringGrid1 );
end;
finally
FreeAndNil(lStrList);
FreeAndNil(lForm);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
i: Integer;
begin
// Self.FVerarbeitung := TVerarbeitung.Create;
if FileExists('
test.txt')
then
begin
self.LoadStringGridFromFile(StringGrid1, '
test.txt');
end else
begin
StringGrid1.Cols[1].Text := '
Gewicht';
StringGrid1.Cols[2].Text := '
Taille';
StringGrid1.Cols[3].Text := '
Hüfte';
StringGrid1.Cols[4].Text := '
Oberschenkel';
StringGrid1.Cols[5].Text := '
Ziel (%)';
StringGrid1.Cols[6].Text := '
BMI';
StringGrid1.Rows[1].Text := '
Start';
for i := 2
to StringGrid1.RowCount - 1
do
begin
StringGrid1.Rows[i].Text := '
Woche ' + IntToStr(i -1);
end;
end;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
// FreeAndNil(Self.FVerarbeitung);
if FileExists('
test.txt')
then
begin
Self.SaveStringGridToFile(StringGrid1, '
test.txt');
end;
end;
procedure TForm1.LoadStringGridFromFile(AStringGrid: TStringGrid;
const AFileName:
String);
var
lStrList: TStringList;
i: Integer;
begin
lStrList := TStringList.Create;
try
lStrList.LoadFromFile(AFileName);
AStringGrid.RowCount := StrToInt(lStrList[0]);
AStringGrid.ColCount := StrToInt(lStrList[1]);
for i := 0
to (AStringGrid.RowCount - 1)
do
begin
AStringGrid.Rows[i].CommaText := lStrList[i + 2];
end;
finally
lStrList.Free;
end;
end;
procedure TForm1.SaveStringGridToFile(AStringGrid: TStringGrid;
const AFileName:
String);
var
lStrList: TStringList;
i: Integer;
begin
lStrList := TStringList.Create;
try
lStrList.Add(IntToStr(AStringGrid.RowCount));
lStrList.Add(IntToStr(AStringGrid.ColCount));
for i := 0
to (AStringGrid.RowCount - 1)
do
begin
lStrList.Add(AStringGrid.Rows[i].CommaText);
end;
lStrList.SaveToFile(AFileName);
finally
lStrList.Free;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
// Form1.Update;
StringGrid1.Refresh;
end;
// with Self.FVerarbeitung do
// begin
// Gewicht.StartGew := StrToFloat(EditStartgew.Text);
// Gewicht.ZielGew := StrToFloat(EditZielGew.Text);
// Gewicht.NewGew := StrToFloat(EditNewGew.Text);
// Size := StrToFloat(EditHeight.Text);
//
// EditBMI.Text := FloatToStr(NewBMI);
// EditProzent.Text := FloatToStr(ProzTarget);
// end;
end.