summaryrefslogtreecommitdiff
path: root/examples/gui/alignment
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-07-23 09:40:43 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-07-23 09:40:43 +0000
commit652ba160012b1eda3a1f6dafb9311b0dcade476c (patch)
tree8abf8d7cc6246484c646b8160b8ab0179ac5b069 /examples/gui/alignment
parent6bda2054c8dda9b98f9958c54fce9f27927642c5 (diff)
downloadfpGUI-652ba160012b1eda3a1f6dafb9311b0dcade476c.tar.xz
Restructure Part 3.
* Moved all the examples over from the prototype directory. * Removed obsolete GFX examples.
Diffstat (limited to 'examples/gui/alignment')
-rw-r--r--examples/gui/alignment/aligntest.dpr107
-rw-r--r--examples/gui/alignment/aligntest.lpi52
2 files changed, 159 insertions, 0 deletions
diff --git a/examples/gui/alignment/aligntest.dpr b/examples/gui/alignment/aligntest.dpr
new file mode 100644
index 00000000..7099b761
--- /dev/null
+++ b/examples/gui/alignment/aligntest.dpr
@@ -0,0 +1,107 @@
+program aligntest;
+
+{$mode objfpc}{$H+}
+
+uses
+ Classes, SysUtils,
+ fpgfx, gfxbase, gfx_widget, gui_form, gui_label;
+
+type
+ TMainForm = class(TfpgForm)
+ private
+ lblTop: array[1..3] of TfpgLabel;
+ lblBottom: array[1..3] of TfpgLabel;
+ lblLeft: array[1..3] of TfpgLabel;
+ lblRight: array[1..3] of TfpgLabel;
+ lblClient: TfpgLabel;
+ lblNone: TfpgLabel;
+ AlignRect: TfpgRect;
+ public
+ procedure AfterCreate; override;
+ end;
+
+
+{ TMainForm }
+
+procedure TMainForm.AfterCreate;
+var
+ x: integer;
+ y: integer;
+ n: integer;
+ ColorArray: array[1..3] of TfpgColor;
+begin
+ x := 10;
+ y := 10;
+ ColorArray[1] := clDodgerBlue;
+ ColorArray[2] := clDeepSkyBlue;
+ ColorArray[3] := clSkyBlue;
+
+ for n := low(lblTop) to high(lblTop) do
+ begin
+ lblTop[n] := CreateLabel(self, x, y, 'alTop '+IntToStr(n));
+ lblTop[n].BackgroundColor := ColorArray[n];
+ lblTop[n].Align := alTop;
+ lblTop[n].Width := 100;
+ inc(y,20);
+ end;
+
+ y := 280;
+ for n:=low(lblBottom) to high(lblBottom) do
+ begin
+ lblBottom[n] := CreateLabel(self, x, y, 'alBottom '+IntToStr(n));
+ lblBottom[n].BackgroundColor := ColorArray[n];
+ lblBottom[n].Align := alBottom;
+ dec(y,20);
+ end;
+
+ y := 100;
+ x := 10;
+ for n:=low(lblLeft) to high(lblLeft) do
+ begin
+ lblLeft[n] := CreateLabel(self, x, y, 'L'+IntToStr(n));
+ lblLeft[n].BackgroundColor := ColorArray[n];
+ lblLeft[n].Align := alLeft;
+ inc(x,30);
+ end;
+
+ x := 200;
+ for n:=low(lblRight) to high(lblRight) do
+ begin
+ lblRight[n] := CreateLabel(self, x, y, 'R'+IntToStr(n));
+ lblRight[n].BackgroundColor := ColorArray[n];
+ lblRight[n].Align := alRight;
+ dec(x,30);
+ end;
+
+ lblClient := CreateLabel(self, 150, 150, 'alClient');
+ lblClient.BackgroundColor := clWhite;
+ lblClient.Align := alClient;
+
+ lblNone := CreateLabel(self, 15, 120, 'Resize the form to see Align in action');
+ lblNone.Color := clWhite;
+ lblNone.BackgroundColor := clBlack;
+end;
+
+
+procedure MainProc;
+var
+ frm : TMainForm;
+begin
+ fpgApplication.Initialize;
+
+ frm := TMainForm.Create(nil);
+ frm.WindowPosition := wpScreenCenter;
+ frm.Width := 300;
+ frm.Height := 300;
+ frm.MinWidth := 250;
+ frm.MinHeight := 150;
+ frm.WindowTitle := 'fpGUI Align Example';
+ frm.Show;
+
+ fpgApplication.Run;
+end;
+
+begin
+ MainProc;
+end.
+
diff --git a/examples/gui/alignment/aligntest.lpi b/examples/gui/alignment/aligntest.lpi
new file mode 100644
index 00000000..5d943df0
--- /dev/null
+++ b/examples/gui/alignment/aligntest.lpi
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<CONFIG>
+ <ProjectOptions>
+ <PathDelim Value="/"/>
+ <Version Value="5"/>
+ <General>
+ <SessionStorage Value="InProjectDir"/>
+ <MainUnit Value="0"/>
+ <IconPath Value="./"/>
+ <TargetFileExt Value=""/>
+ </General>
+ <VersionInfo>
+ <ProjectVersion Value=""/>
+ </VersionInfo>
+ <PublishOptions>
+ <Version Value="2"/>
+ <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
+ <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
+ </PublishOptions>
+ <RunParams>
+ <local>
+ <FormatVersion Value="1"/>
+ <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
+ </local>
+ </RunParams>
+ <RequiredPackages Count="1">
+ <Item1>
+ <PackageName Value="fpGFX2"/>
+ </Item1>
+ </RequiredPackages>
+ <Units Count="1">
+ <Unit0>
+ <Filename Value="aligntest.dpr"/>
+ <IsPartOfProject Value="True"/>
+ </Unit0>
+ </Units>
+ </ProjectOptions>
+ <CompilerOptions>
+ <Version Value="5"/>
+ <SearchPaths>
+ <IncludeFiles Value="../src/"/>
+ <OtherUnitFiles Value="../src/"/>
+ </SearchPaths>
+ <CodeGeneration>
+ <Generate Value="Faster"/>
+ </CodeGeneration>
+ <Other>
+ <CustomOptions Value="-FUunits"/>
+ <CompilerPath Value="$(CompPath)"/>
+ </Other>
+ </CompilerOptions>
+</CONFIG>