summaryrefslogtreecommitdiff
path: root/prototypes
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2013-04-12 17:57:29 +0100
committerGraeme Geldenhuys <graemeg@gmail.com>2013-04-12 18:29:05 +0100
commitaf6de89e189c6ce39873c901814b7b29a1bb1782 (patch)
treef6d45b114e622a3a0f24def7488652921672726c /prototypes
parent13bcba33ab75bae5fdf1e59de0f82cc67cf1609a (diff)
downloadfpGUI-af6de89e189c6ce39873c901814b7b29a1bb1782.tar.xz
MDI: work area now has a CascadeWindows method.
Diffstat (limited to 'prototypes')
-rw-r--r--prototypes/mdi/fpg_mdi.pas30
1 files changed, 30 insertions, 0 deletions
diff --git a/prototypes/mdi/fpg_mdi.pas b/prototypes/mdi/fpg_mdi.pas
index ac127a33..0af5a138 100644
--- a/prototypes/mdi/fpg_mdi.pas
+++ b/prototypes/mdi/fpg_mdi.pas
@@ -29,6 +29,7 @@ type
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function AddWindow(AWindowClass: TfpgFrameClass): TfpgFrame;
+ procedure CascadeWindows;
property ActiveWindow: TfpgMDIChildForm read FActiveWindow write SetActiveWindow;
property ChildWindowCount: integer read GetChildWindowCount;
end;
@@ -434,5 +435,34 @@ begin
ActiveWindow := frm;
end;
+procedure TfpgMDIWorkArea.CascadeWindows;
+const
+ GAP = 25;
+var
+ w: integer;
+ i: integer;
+ c: TfpgMDIChildForm;
+ x, y: integer;
+begin
+ x := 5;
+ y := 5;
+ for i := 0 to ComponentCount -1 do
+ begin
+ if Components[i] is TfpgScrollBar then
+ continue;
+ if Components[i] is TfpgMDIChildForm then
+ begin
+ c := Components[i] as TfpgMDIChildForm;
+ c.Left := x;
+ x += GAP;
+ c.Top := y;
+ y += GAP;
+ c.UpdateWindowPosition;
+ c.BringToFront;
+ end;
+ end;
+ ActiveWindow := c;
+end;
+
end.