From af6de89e189c6ce39873c901814b7b29a1bb1782 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 12 Apr 2013 17:57:29 +0100 Subject: MDI: work area now has a CascadeWindows method. --- prototypes/mdi/fpg_mdi.pas | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'prototypes') 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. -- cgit v1.2.3-70-g09d2