summaryrefslogtreecommitdiff
path: root/examples/gui/alignment/aligntest.lpr
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-01-14 18:08:11 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-01-14 18:08:11 +0000
commite87fb75ceacdd647ad507ff2704f839838f93d87 (patch)
tree74fb1393488c14a3eeaf388fe2e6204dce747e79 /examples/gui/alignment/aligntest.lpr
parentecfb462fd56c4508b1e66a4c7fde09097e80f8d8 (diff)
downloadfpGUI-e87fb75ceacdd647ad507ff2704f839838f93d87.tar.xz
* Removed a debug writeln statement from gui_edit unit.
* Added the extra interpolation unit to fpgfx.pas so it can be auto compiled from the scripts in the src directory. * Added the missing extrafpc.cfg files from some example projects. * Renamed some of the examples main units to have the lpr extension. Consistancy with the other projects. * FreeBSD is now an official supported platform. I've compiled and ran all example and prototype projects. Everything works perfectly.
Diffstat (limited to 'examples/gui/alignment/aligntest.lpr')
-rw-r--r--examples/gui/alignment/aligntest.lpr108
1 files changed, 108 insertions, 0 deletions
diff --git a/examples/gui/alignment/aligntest.lpr b/examples/gui/alignment/aligntest.lpr
new file mode 100644
index 00000000..60d98ba5
--- /dev/null
+++ b/examples/gui/alignment/aligntest.lpr
@@ -0,0 +1,108 @@
+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;
+ frm.Free;
+end;
+
+begin
+ MainProc;
+end.
+