unit open;
interface
uses
Winapi.Windows,
Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.Grids,
Vcl.ValEdit,
Vcl.StdCtrls,
Vcl.ExtCtrls,
Vcl.DBCtrls,
Vcl.DBGrids, Data.DB, Datasnap.DBClient;
type
TFrmOpen =
class(TForm)
Button1: TButton;
Button2: TButton;
DS: TDataSource;
CDS: TClientDataSet;
CDSspeise: TStringField;
CDSpreis: TFloatField;
DBGrid1: TDBGrid;
DBNavigator1: TDBNavigator;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure GenerateButton;
private
{ Private-Deklarationen }
LBe: Boolean;
LBut:
array of TButton;
public
{ Public-Deklarationen }
end;
var
FrmOpen: TFrmOpen;
implementation
{$R *.dfm}
uses scan, use;
procedure TFrmOpen.Button1Click(Sender: TObject);
begin
if not LBe
then begin
FrmOpen.Width := 609;
LBe := true;
end else begin
FrmOpen.Width := 369;
Lbe:= false;
end;
end;
procedure TFrmOpen.Button2Click(Sender: TObject);
begin
FrmScan.Show;
end;
procedure TFrmOpen.FormCreate(Sender: TObject);
begin
Lbe := false;
CDS.FileName := '
custom.xml';
if FileExists(CDS.FileName)
then begin
CDS.LoadFromFile(CDS.FileName);
GenerateButton;
end else begin
CDS.CreateDataSet;
end;
end;
procedure TFrmOpen.GenerateButton;
var i: Integer;
begin
CDS.First;
for i := 0
to CDS.RecNo
do begin
LBut[i] := TButton.Create(FrmUse.BoxScro);
LBut[i].Parent := FrmUse.BoxScro;
LBut[i].Left := 20 + ((LBut[i].Height + 10) * i);
LBut[i].Height := 20;
if (i >= 5)
then LBut[i].Height := 20 + ((LBut[i].Height + 10) * i);
LBut[i].Caption := CDS.FieldByName('
test').Value;
CDS.Next;
end;
end;
end.