unit Haupfenster;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls,
FMX.Layouts, FMX.Ani, FMX.Objects, Contnrs;
type
TForm1 =
class(TForm)
StyleBook1: TStyleBook;
ProduktMeneu: TPanel;
Oben: TPanel;
Seite: TPanel;
FlowLayout2: TFlowLayout;
Waermepumpe: TExpander;
Solar: TExpander;
Expander3: TExpander;
Lueftung: TExpander;
Start: TPanel;
Unten: TPanel;
ImageControl7: TImageControl;
Image1: TImage;
FloatAnimation1: TFloatAnimation;
FloatAnimation2: TFloatAnimation;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Image2: TImage;
Image3: TImage;
Label13: TLabel;
Label14: TLabel;
Image4: TImage;
Image5: TImage;
Image6: TImage;
Label15: TLabel;
Image7: TImage;
Label16: TLabel;
Image8: TImage;
Label17: TLabel;
Label18: TLabel;
Menue: TPanel;
FloatAnimation3: TFloatAnimation;
FloatAnimation4: TFloatAnimation;
Image9: TImage;
Label19: TLabel;
Image11: TImage;
Label21: TLabel;
Image12: TImage;
Label22: TLabel;
Image13: TImage;
Label23: TLabel;
Image10: TImage;
Label20: TLabel;
Image14: TImage;
Label24: TLabel;
Image15: TImage;
Label25: TLabel;
ImageControl1: TImageControl;
ImageControl2: TImageControl;
ImageControl3: TImageControl;
ImageControl4: TImageControl;
ImageControl5: TImageControl;
Image16: TImage;
Image17: TImage;
Label26: TLabel;
Expander1: TExpander;
Image18: TImage;
procedure FormResize(Sender: TObject);
procedure ImageControl7Click(Sender: TObject);
function panelzoom():boolean;
function buttonzoom():boolean;
function buttonzoomout():boolean;
procedure Image4Click(Sender: TObject);
procedure Image8Click(Sender: TObject);
procedure ImageControl1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
TExpanderNeu =
class(TExpander)
private
public
constructor Create(AOwner: TComponent);
override;
destructor Destroy;
override;
procedure groß(Sender: TObject);
procedure klein(Sender: TObject);
end;
var
Form1: TForm1;
y, i,j,x,test: integer;
progPfad,datei2 :
string;
ExpanderArray:
array of TExpanderNeu;
implementation
{$R *.fmx}
constructor TExpanderNeu.Create;
begin
inherited;
end;
destructor TExpanderNeu.Destroy;
begin
inherited;
end;
procedure TExpanderNeu.groß(Sender: TObject);
begin
StyleLookup := '
expanderstyle';
Width := 300;
end;
procedure TExpanderNeu.klein;
begin
BeginUpdate;
StyleLookup := '
expanderstyleneu';
Width := 125;
EndUpdate;
end;
procedure createBild(AOwner: TFmxObject);
var
newBild :Timage;
begin
newBild := TImage.Create(AOwner);
with newBild
do begin
parent := AOwner;
Bitmap.CreateFromFile(Pchar(Progpfad+'
Bilder\Lueftung.png'));
position.X := 222;
position.Y := -24;
height := 125;
width := 78;
end;
end;
procedure createExpanderNeu(AOwner: TFmxObject; labelText :
String; posX, posY, hoehe, breite,i : integer);
var
Expander : TExpanderNeu;
begin
SetLength(ExpanderArray,Length(ExpanderArray)+1);
ExpanderArray[i] := TExpanderNeu.Create(AOwner);
with Expander
do begin
ExpanderArray[i].Parent := Form1.FlowLayout2;
ExpanderArray[i].HitTest := true;
ExpanderArray[i].Text := labelText;
ExpanderArray[i].Cursor := crHandPoint;
ExpanderArray[i].height := hoehe;
ExpanderArray[i].width := breite;
end;
createBild(ExpanderArray[i]);
end;
function TForm1.panelzoom():boolean;
begin
if y <> 99
then begin
i := 1;
y := 99;
end;
if i = 1
then begin
FloatAnimation2.Enabled := false;
FloatAnimation1.Enabled := true;
imagecontrol7.LoadFromFile(Progpfad+'
Bilder\Icons\Pfeil_links_schwarz.png');
i := 0;
end else
begin
FloatAnimation1.Enabled := false;
FloatAnimation2.Enabled := true;
imagecontrol7.LoadFromFile(Progpfad+'
Bilder\Icons\Pfeil_Rechts_schwarz.png');
i := 1;
end;
end;
function TForm1.buttonzoom():boolean;
var
panel : TExpanderNeu;
begin
Waermepumpe.StyleLookup := '
expanderstyleneu';
Waermepumpe.Width := 125;
solar.StyleLookup := '
expanderstyleneu';
solar.Width := 125;
expander3.StyleLookup := '
expanderstyleneu';
expander3.Width := 125;
lueftung.StyleLookup := '
expanderstyleneu';
lueftung.Width := 125;
end;
function TForm1.buttonzoomout():boolean;
begin
Waermepumpe.StyleLookup := '
expanderstyle';
Waermepumpe.Width := 300;
solar.StyleLookup := '
expanderstyle';
solar.Width := 300;
expander3.StyleLookup := '
expanderstyle';
expander3.Width := 300;
lueftung.StyleLookup := '
expanderstyle';
lueftung.Width := 300;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
i : integer;
text:
array[1..10]
of string;
AOwner: TFmxObject;
begin
ProgPfad := ExpandFileName('
KPN.exe');
delete(ProgPfad,length(ProgPfad)-6,256);
text[1]:= '
Wärmepumpe';
text[2]:= '
Solar';
text[3]:= '
Lüftung';
text[4]:= '
Heizkessel';
text[5]:= '
Speicher';
SetLength(ExpanderArray,0);
for i := 1
to 5
do begin
createExpanderNeu(image6,Text[i], 222, -24, 125, 300,i);
end;
label26.Text := IntToStr(Flowlayout2.ChildrenCount);
end;
procedure TForm1.FormResize(Sender: TObject);
var
zaehler : integer;
begin
if y <> 99
then begin
i := 1;
y := 99;
end;
if Form1.Width < 300*2.2
then begin
for zaehler := 0
to Length(ExpanderArray) - 1
do
begin
ExpanderArray[zaehler].klein(ExpanderArray[zaehler])
end;
buttonzoom;
if (ProduktMeneu.Width > 200)
and (i = 1)
then begin
panelzoom();
Label18.Visible := false;
i := 0;
end;
end else begin
buttonzoomout;
if (ProduktMeneu.Width < 200)
and (i = 0)
then begin
panelzoom();
Label18.Visible := true;
i := 1;
end;
end;
end;
procedure TForm1.Image4Click(Sender: TObject);
begin
start.Enabled :=false;
start.Visible := false;
end;
procedure TForm1.Image8Click(Sender: TObject);
begin
if x <> 99
then begin
j := 1;
x := 99;
end;
if j = 1
then begin
FloatAnimation4.Enabled := false;
FloatAnimation3.Enabled := true;
j := 0;
end else begin
FloatAnimation3.Enabled := false;
FloatAnimation4.Enabled := true;
j := 1;
end;
end;
procedure TForm1.ImageControl1Click(Sender: TObject);
var
Expander : TExpanderNeu;
begin
if test <> 1
then begin
imagecontrol1.LoadFromFile(Progpfad+'
Bilder\Icons\icon-biomasse-xl.png');
waermepumpe.Visible := true;
solar.Visible := false;
ExpanderArray[i].Destroy;
// solar.Destroy;
// expander3.Enabled := false;
lueftung.Visible := false;
// lueftung.Destroy;
test :=1;
flowlayout2.Width :=0;
end else begin
imagecontrol1.LoadFromFile(Progpfad+'
Bilder\Icons\icon-biomasse-weiss-xl.png');
waermepumpe.Visible := true;
solar.Visible := true;
// expander3.Enabled := false;
lueftung.Visible := true;
test :=2;
flowlayout2.Width :=0;
end;
end;
procedure TForm1.ImageControl7Click(Sender: TObject);
begin
panelzoom()
end;
end.