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 From 9be4072b65ba67dfb82224ba5cda84489135612f Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 12 Apr 2013 17:59:14 +0100 Subject: MDI prototype: fixes code to remove compiler hints --- prototypes/mdi/fpg_mdi.pas | 2 +- prototypes/mdi/frm_child.pas | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'prototypes') diff --git a/prototypes/mdi/fpg_mdi.pas b/prototypes/mdi/fpg_mdi.pas index 0af5a138..d04acb3e 100644 --- a/prototypes/mdi/fpg_mdi.pas +++ b/prototypes/mdi/fpg_mdi.pas @@ -55,7 +55,7 @@ type FIsMouseDown: boolean; FLastPos: TPoint; FActive: boolean; - procedure SetWindowTitle(AValue: TfpgString); + procedure SetWindowTitle(AValue: TfpgString); reintroduce; procedure TitleMouseMove(Sender: TObject; AShift: TShiftState; const AMousePos: TPoint); procedure TitleMouseUp(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint); procedure TitleMouseDown(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint); diff --git a/prototypes/mdi/frm_child.pas b/prototypes/mdi/frm_child.pas index a9890a3c..0d71b52d 100644 --- a/prototypes/mdi/frm_child.pas +++ b/prototypes/mdi/frm_child.pas @@ -5,7 +5,7 @@ unit frm_child; interface uses - SysUtils, Classes, fpg_base, fpg_main, fpg_form, fpg_button, fpg_edit, + SysUtils, Classes, fpg_base, fpg_main, fpg_button, fpg_edit, fpg_checkbox, fpg_radiobutton, fpg_gauge, fpg_mdi, fpg_panel, fpg_trackbar; type @@ -25,7 +25,7 @@ type FWindowTitle: TfpgString; procedure btnCloseClicked(Sender: TObject); procedure TrackBarChanged(Sender: TObject; APosition: integer); - procedure SetWindowTitle(AValue: TfpgString); + procedure SetWindowTitle(const ATitle: TfpgString); reintroduce; public procedure AfterCreate; override; property WindowTitle: TfpgString read FWindowTitle write SetWindowTitle; @@ -46,11 +46,11 @@ begin Gauge1.Progress := APosition; end; -procedure TChildForm.SetWindowTitle(AValue: TfpgString); +procedure TChildForm.SetWindowTitle(const ATitle: TfpgString); begin - if FWindowTitle = AValue then + if FWindowTitle = ATitle then Exit; - FWindowTitle := AValue; + FWindowTitle := ATitle; TfpgMDIChildForm(Owner.Owner).WindowTitle := FWindowTitle; end; -- cgit v1.2.3-70-g09d2 From e1fe151dc97435361190f3eee698d230e4a61308 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 12 Apr 2013 18:01:53 +0100 Subject: MDI child windows now have a OnMove event --- prototypes/mdi/fpg_mdi.pas | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'prototypes') diff --git a/prototypes/mdi/fpg_mdi.pas b/prototypes/mdi/fpg_mdi.pas index d04acb3e..0e290800 100644 --- a/prototypes/mdi/fpg_mdi.pas +++ b/prototypes/mdi/fpg_mdi.pas @@ -9,7 +9,10 @@ uses fpg_button; type - // forward declarations + + TfpgMDIChildMoveEvent = procedure(Sender: TObject; const rec: TfpgMoveEventRec) of object; + + // forward declarations TfpgMDIChildForm = class; @@ -55,6 +58,7 @@ type FIsMouseDown: boolean; FLastPos: TPoint; FActive: boolean; + FOnMove: TfpgMDIChildMoveEvent; procedure SetWindowTitle(AValue: TfpgString); reintroduce; procedure TitleMouseMove(Sender: TObject; AShift: TShiftState; const AMousePos: TPoint); procedure TitleMouseUp(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint); @@ -62,7 +66,9 @@ type procedure TitleMouseExit(Sender: TObject); procedure CloseMDIWindowClicked(Sender: TObject); procedure SetActive(AValue: boolean); + procedure DoOnMove(const x, y: TfpgCoord); protected + procedure HandleMove(x, y: TfpgCoord); override; property Active: boolean read FActive write SetActive; public constructor Create(AOwner: TfpgMDIWorkArea); reintroduce; @@ -70,6 +76,8 @@ type procedure SetClientFrame(AFrame: TfpgFrame); procedure UpdateWindowTitle; procedure Close; + published + property OnMove: TfpgMDIChildMoveEvent read FOnMove write FOnMove; end; implementation @@ -151,6 +159,25 @@ begin end; end; +procedure TfpgMDIChildForm.DoOnMove(const x, y: TfpgCoord); +var + rec: TfpgMoveEventRec; +begin + if Assigned(FOnMove) then + begin + rec.Sender := self; + rec.x := x; + rec.y := y; + FOnMove(self, rec); + end; +end; + +procedure TfpgMDIChildForm.HandleMove(x, y: TfpgCoord); +begin + inherited HandleMove(x, y); + DoOnMove(x, y); +end; + procedure TfpgMDIChildForm.SetWindowTitle(AValue: TfpgString); begin if FWindowTitle = AValue then -- cgit v1.2.3-70-g09d2 From b24d34f161a26daab6ab625535c2ea27b7c9d74e Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 12 Apr 2013 18:04:31 +0100 Subject: MDI prototype now has basic horizontal scrollbar support. --- prototypes/mdi/fpg_mdi.pas | 109 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 104 insertions(+), 5 deletions(-) (limited to 'prototypes') diff --git a/prototypes/mdi/fpg_mdi.pas b/prototypes/mdi/fpg_mdi.pas index 0e290800..9087213d 100644 --- a/prototypes/mdi/fpg_mdi.pas +++ b/prototypes/mdi/fpg_mdi.pas @@ -22,11 +22,17 @@ type FVerBar: TfpgScrollbar; FList: TList; FActiveWindow: TfpgMDIChildForm; + FScrollingHorizonal: Boolean; + FLastHorizonalPos: integer; procedure InternalMsgFreeMe(var msg: TfpgMessageRec); message FPGM_FREEME; procedure SetActiveWindow(AValue: TfpgMDIChildForm); function GetChildWindowCount: integer; + procedure MDIChildMoved(Sender: TObject; const rec: TfpgMoveEventRec); + function CalcVirtualWidth: integer; + procedure HorizontalScrollBarScrolled(Sender: TObject; position: integer); protected procedure HandlePaint; override; + procedure HandleResize(AWidth, AHeight: TfpgCoord); override; procedure PositionScrollBars; public constructor Create(AOwner: TComponent); override; @@ -66,6 +72,7 @@ type procedure TitleMouseExit(Sender: TObject); procedure CloseMDIWindowClicked(Sender: TObject); procedure SetActive(AValue: boolean); + procedure ChildFormResized(Sender: TObject); procedure DoOnMove(const x, y: TfpgCoord); protected procedure HandleMove(x, y: TfpgCoord); override; @@ -159,6 +166,11 @@ begin end; end; +procedure TfpgMDIChildForm.ChildFormResized(Sender: TObject); +begin + SendDebug('ChildFormResize'); +end; + procedure TfpgMDIChildForm.DoOnMove(const x, y: TfpgCoord); var rec: TfpgMoveEventRec; @@ -195,9 +207,10 @@ begin FLastPos := Point(0,0); {@VFD_BODY_BEGIN: MDIChildForm} Name := 'MDIChildForm'; - SetPosition(369, 166, 300, 250); + SetPosition(10, 10, 300, 250); WindowTitle := 'ChildForm1'; Hint := ''; + OnResize := @ChildFormResized; Panel1 := TfpgPanel.Create(self); with Panel1 do @@ -412,12 +425,91 @@ begin Result := FList.Count; end; +procedure TfpgMDIWorkArea.MDIChildMoved(Sender: TObject; const rec: TfpgMoveEventRec); +var + w: integer; +begin + if FScrollingHorizonal then + Exit; // We are using the scrollbar to slide windows in/out of view + w := CalcVirtualWidth; + if w > Width then + begin + FHorBar.Max := w - Width; + FHorBar.SliderSize := Width / w; + if not FHorBar.Visible then + begin + FHorBar.Position := 0; + FLastHorizonalPos := 0; + FHorBar.Visible := True + end + else + FHorBar.RepaintSlider; + end + else + FHorBar.Visible := False; +end; + +function TfpgMDIWorkArea.CalcVirtualWidth: integer; +var + w: integer; + i: integer; + c: TfpgMDIChildForm; +begin + w := Width; + 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; + if c.Left < 0 then + w := Width + Abs(c.Left); + if c.Right > w then + w := c.Right; + end; + end; + Result := w; +end; + +procedure TfpgMDIWorkArea.HorizontalScrollBarScrolled(Sender: TObject; position: integer); +var + w: integer; + i: integer; + c: TfpgMDIChildForm; +begin + FScrollingHorizonal := True; + 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 := c.Left + (FLastHorizonalPos - position); + c.UpdateWindowPosition; + fpgApplication.ProcessMessages; + end; + end; + FLastHorizonalPos := position; + FScrollingHorizonal := False; +end; + procedure TfpgMDIWorkArea.HandlePaint; begin inherited HandlePaint; Canvas.Clear(clLtGray); end; +procedure TfpgMDIWorkArea.HandleResize(AWidth, AHeight: TfpgCoord); +var + rec: TfpgMoveEventRec; +begin + inherited HandleResize(AWidth, AHeight); + if ComponentCount > 2 then + MDIChildMoved(self, rec); +end; + procedure TfpgMDIWorkArea.PositionScrollBars; begin FHorBar.Left := Left; @@ -434,14 +526,20 @@ constructor TfpgMDIWorkArea.Create(AOwner: TComponent); begin inherited Create(AOwner); FIsContainer := True; - FHorBar := TfpgScrollbar.Create(self); + FScrollingHorizonal := False; + + FHorBar := TfpgScrollbar.Create(self); FHorBar.Visible := False; FHorBar.Orientation := orHorizontal; - FVerBar := TfpgScrollbar.Create(self); + FHorBar.OnScroll := @HorizontalScrollBarScrolled; + + FVerBar := TfpgScrollbar.Create(self); FVerBar.Visible := False; FVerBar.Orientation := orVertical; - PositionScrollBars; - FList := TList.Create; + + PositionScrollBars; + + FList := TList.Create; FActiveWindow := nil; end; @@ -458,6 +556,7 @@ begin frm := TfpgMDIChildForm.Create(self); Result := AWindowClass.Create(frm.bvlClientArea); frm.SetClientFrame(Result); + frm.OnMove := @MDIChildMoved; FList.Add(frm); ActiveWindow := frm; end; -- cgit v1.2.3-70-g09d2 From 93981dca15f320ffcc22de8111e1b5feea6fb03e Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 12 Apr 2013 18:05:24 +0100 Subject: MDI prototype: demo project now uses the Cascade Windows functionality --- prototypes/mdi/project1.lpr | 95 +++++++++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 43 deletions(-) (limited to 'prototypes') diff --git a/prototypes/mdi/project1.lpr b/prototypes/mdi/project1.lpr index fdde8f0d..ea7cd3ca 100644 --- a/prototypes/mdi/project1.lpr +++ b/prototypes/mdi/project1.lpr @@ -15,13 +15,14 @@ type TMainForm = class(TfpgForm) private {@VFD_HEAD_BEGIN: MainForm} - MainBar: TfpgMenuBar; - MDIWorkArea: TfpgMDIWorkArea; - Bevel1: TfpgBevel; - pmChildren: TfpgPopupMenu; - {@VFD_HEAD_END: MainForm} + MainBar: TfpgMenuBar; + MDIWorkArea: TfpgMDIWorkArea; + Bevel1: TfpgBevel; + pmChildren: TfpgPopupMenu; + {@VFD_HEAD_END: MainForm} procedure NewFormClicked(Sender: TObject); procedure miQuitClicked(Sender: TObject); + procedure miCascadeChildWindows(Sender: TObject); public procedure AfterCreate; override; end; @@ -43,52 +44,60 @@ begin Close; end; +procedure TMainForm.miCascadeChildWindows(Sender: TObject); +begin + MDIWorkArea.CascadeWindows; +end; + procedure TMainForm.AfterCreate; begin {%region 'Auto-generated GUI code' -fold} {@VFD_BODY_BEGIN: MainForm} - Name := 'MainForm'; - SetPosition(351, 159, 555, 321); - WindowTitle := 'fpGUI''s MDI Demo'; - Hint := ''; - - MainBar := TfpgMenuBar.Create(self); - with MainBar do - begin - Name := 'MainBar'; - SetPosition(0, 0, 555, 24); - Anchors := [anLeft,anRight,anTop]; - end; + Name := 'MainForm'; + SetPosition(351, 159, 555, 360); + WindowTitle := 'fpGUI''s MDI Demo'; + Hint := ''; + + MainBar := TfpgMenuBar.Create(self); + with MainBar do + begin + Name := 'MainBar'; + SetPosition(0, 0, 555, 24); + Anchors := [anLeft,anRight,anTop]; + end; - MDIWorkArea := TfpgMDIWorkArea.Create(self); - with MDIWorkArea do - begin - Name := 'MDIWorkArea'; - SetPosition(3, 32, 548, 264); - Anchors := [anLeft,anRight,anTop,anBottom]; - end; + MDIWorkArea := TfpgMDIWorkArea.Create(self); + with MDIWorkArea do + begin + Name := 'MDIWorkArea'; + SetPosition(3, 32, 548, 303); + Anchors := [anLeft,anRight,anTop,anBottom]; + end; - Bevel1 := TfpgBevel.Create(self); - with Bevel1 do - begin - Name := 'Bevel1'; - SetPosition(0, 300, 555, 20); - Anchors := [anLeft,anRight,anBottom]; - Hint := ''; - Style := bsLowered; - end; + Bevel1 := TfpgBevel.Create(self); + with Bevel1 do + begin + Name := 'Bevel1'; + SetPosition(0, 339, 555, 20); + Anchors := [anLeft,anRight,anBottom]; + Hint := ''; + Style := bsLowered; + end; - pmChildren := TfpgPopupMenu.Create(self); - with pmChildren do - begin - Name := 'pmChildren'; - SetPosition(336, 88, 120, 20); - AddMenuItem('Add child', '', @NewFormClicked); - AddMenuItem('-', '', nil); - AddMenuItem('Quit', '', @miQuitClicked); - end; + pmChildren := TfpgPopupMenu.Create(self); + with pmChildren do + begin + Name := 'pmChildren'; + SetPosition(336, 88, 120, 20); + AddMenuItem('Add child', '', @NewFormClicked); + AddSeparator; + AddMenuItem('Cascade', '', @miCascadeChildWindows); + AddMenuItem('Tile', '', nil).Enabled := False; + AddSeparator; + AddMenuItem('Quit', '', @miQuitClicked); + end; - {@VFD_BODY_END: MainForm} + {@VFD_BODY_END: MainForm} {%endregion} MainBar.AddMenuItem('Children', nil).SubMenu := pmChildren; end; -- cgit v1.2.3-70-g09d2 From eb305aaf7d9537fa69b72c65e085bca6529361be Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 12 Apr 2013 18:16:07 +0100 Subject: MDI: fixed editor settings screwup. Converted Tabs -> Spaces --- prototypes/mdi/fpg_mdi.pas | 648 +++++++++++++++++++++---------------------- prototypes/mdi/frm_child.pas | 250 ++++++++--------- prototypes/mdi/project1.lpr | 22 +- 3 files changed, 460 insertions(+), 460 deletions(-) (limited to 'prototypes') diff --git a/prototypes/mdi/fpg_mdi.pas b/prototypes/mdi/fpg_mdi.pas index 9087213d..88bb4d33 100644 --- a/prototypes/mdi/fpg_mdi.pas +++ b/prototypes/mdi/fpg_mdi.pas @@ -13,157 +13,157 @@ type TfpgMDIChildMoveEvent = procedure(Sender: TObject; const rec: TfpgMoveEventRec) of object; // forward declarations - TfpgMDIChildForm = class; + TfpgMDIChildForm = class; - TfpgMDIWorkArea = class(TfpgWidget) - private - FHorBar: TfpgScrollbar; - FVerBar: TfpgScrollbar; - FList: TList; - FActiveWindow: TfpgMDIChildForm; + TfpgMDIWorkArea = class(TfpgWidget) + private + FHorBar: TfpgScrollbar; + FVerBar: TfpgScrollbar; + FList: TList; + FActiveWindow: TfpgMDIChildForm; FScrollingHorizonal: Boolean; FLastHorizonalPos: integer; - procedure InternalMsgFreeMe(var msg: TfpgMessageRec); message FPGM_FREEME; - procedure SetActiveWindow(AValue: TfpgMDIChildForm); - function GetChildWindowCount: integer; + procedure InternalMsgFreeMe(var msg: TfpgMessageRec); message FPGM_FREEME; + procedure SetActiveWindow(AValue: TfpgMDIChildForm); + function GetChildWindowCount: integer; procedure MDIChildMoved(Sender: TObject; const rec: TfpgMoveEventRec); function CalcVirtualWidth: integer; procedure HorizontalScrollBarScrolled(Sender: TObject; position: integer); - protected - procedure HandlePaint; override; + protected + procedure HandlePaint; override; procedure HandleResize(AWidth, AHeight: TfpgCoord); override; - procedure PositionScrollBars; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - function AddWindow(AWindowClass: TfpgFrameClass): TfpgFrame; + procedure PositionScrollBars; + public + 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; - - - TfpgMDIChildForm = class(TfpgWidget) - private - {@VFD_HEAD_BEGIN: MDIChildForm} - Panel1: TfpgPanel; - bevLeft: TfpgBevel; - Bevel2: TfpgBevel; - bevBottom: TfpgBevel; - Bevel4: TfpgBevel; - bevRight: TfpgBevel; - Button1: TfpgButton; - Button2: TfpgButton; - Button3: TfpgButton; - Button4: TfpgButton; - bvlClientArea: TfpgBevel; - {@VFD_HEAD_END: MDIChildForm} - FMDIWorkArea: TfpgMDIWorkArea; - FWindowTitle: TfpgString; - FIsMouseDown: boolean; - FLastPos: TPoint; - FActive: boolean; + property ActiveWindow: TfpgMDIChildForm read FActiveWindow write SetActiveWindow; + property ChildWindowCount: integer read GetChildWindowCount; + end; + + + TfpgMDIChildForm = class(TfpgWidget) + private + {@VFD_HEAD_BEGIN: MDIChildForm} + Panel1: TfpgPanel; + bevLeft: TfpgBevel; + Bevel2: TfpgBevel; + bevBottom: TfpgBevel; + Bevel4: TfpgBevel; + bevRight: TfpgBevel; + Button1: TfpgButton; + Button2: TfpgButton; + Button3: TfpgButton; + Button4: TfpgButton; + bvlClientArea: TfpgBevel; + {@VFD_HEAD_END: MDIChildForm} + FMDIWorkArea: TfpgMDIWorkArea; + FWindowTitle: TfpgString; + FIsMouseDown: boolean; + FLastPos: TPoint; + FActive: boolean; FOnMove: TfpgMDIChildMoveEvent; - procedure SetWindowTitle(AValue: TfpgString); reintroduce; - procedure TitleMouseMove(Sender: TObject; AShift: TShiftState; const AMousePos: TPoint); - procedure TitleMouseUp(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint); - procedure TitleMouseDown(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint); - procedure TitleMouseExit(Sender: TObject); - procedure CloseMDIWindowClicked(Sender: TObject); - procedure SetActive(AValue: boolean); + procedure SetWindowTitle(AValue: TfpgString); reintroduce; + procedure TitleMouseMove(Sender: TObject; AShift: TShiftState; const AMousePos: TPoint); + procedure TitleMouseUp(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint); + procedure TitleMouseDown(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint); + procedure TitleMouseExit(Sender: TObject); + procedure CloseMDIWindowClicked(Sender: TObject); + procedure SetActive(AValue: boolean); procedure ChildFormResized(Sender: TObject); procedure DoOnMove(const x, y: TfpgCoord); - protected + protected procedure HandleMove(x, y: TfpgCoord); override; - property Active: boolean read FActive write SetActive; - public - constructor Create(AOwner: TfpgMDIWorkArea); reintroduce; - property WindowTitle: TfpgString read FWindowTitle write SetWindowTitle; - procedure SetClientFrame(AFrame: TfpgFrame); - procedure UpdateWindowTitle; - procedure Close; + property Active: boolean read FActive write SetActive; + public + constructor Create(AOwner: TfpgMDIWorkArea); reintroduce; + property WindowTitle: TfpgString read FWindowTitle write SetWindowTitle; + procedure SetClientFrame(AFrame: TfpgFrame); + procedure UpdateWindowTitle; + procedure Close; published property OnMove: TfpgMDIChildMoveEvent read FOnMove write FOnMove; - end; + end; implementation uses - dbugintf; + dbugintf; { TfpgMDIChildForm } procedure TfpgMDIChildForm.TitleMouseMove(Sender: TObject; AShift: TShiftState; - const AMousePos: TPoint); + const AMousePos: TPoint); var dx, dy: integer; pt: TPoint; begin - pt := WindowToScreen(self, AMousePos); - if not FIsMouseDown then - begin - FLastPos := pt; - Exit; - end; - - dx := pt.X - FLastPos.X; - dy := pt.Y - FLastPos.Y; - Left := Left + dx; - Top := Top + dy; - FLastPos := pt; - UpdateWindowPosition; + pt := WindowToScreen(self, AMousePos); + if not FIsMouseDown then + begin + FLastPos := pt; + Exit; + end; + + dx := pt.X - FLastPos.X; + dy := pt.Y - FLastPos.Y; + Left := Left + dx; + Top := Top + dy; + FLastPos := pt; + UpdateWindowPosition; end; procedure TfpgMDIChildForm.TitleMouseUp(Sender: TObject; AButton: TMouseButton; - AShift: TShiftState; const AMousePos: TPoint); + AShift: TShiftState; const AMousePos: TPoint); begin - FIsMouseDown := False; - Panel1.ReleaseMouse; + FIsMouseDown := False; + Panel1.ReleaseMouse; end; procedure TfpgMDIChildForm.TitleMouseDown(Sender: TObject; AButton: TMouseButton; - AShift: TShiftState; const AMousePos: TPoint); + AShift: TShiftState; const AMousePos: TPoint); begin - FMDIWorkArea.ActiveWindow := self; - FIsMouseDown := True; - FLastPos := Panel1.WindowToScreen(self, AMousePos); - Panel1.CaptureMouse; + FMDIWorkArea.ActiveWindow := self; + FIsMouseDown := True; + FLastPos := Panel1.WindowToScreen(self, AMousePos); + Panel1.CaptureMouse; end; procedure TfpgMDIChildForm.TitleMouseExit(Sender: TObject); begin -// FIsMouseDown := False; +// FIsMouseDown := False; end; procedure TfpgMDIChildForm.CloseMDIWindowClicked(Sender: TObject); begin - Close; + Close; end; procedure TfpgMDIChildForm.SetActive(AValue: boolean); begin - if FActive = AValue then - Exit; - FActive := AValue; - if FActive then - begin - Panel1.BackgroundColor := clNavy; - bevLeft.BackgroundColor := clNavy; - bevBottom.BackgroundColor := clNavy; - bevRight.BackgroundColor := clNavy; - Bevel2.BackgroundColor := clNavy; - Bevel4.BackgroundColor := clNavy; - end - else - begin - Panel1.BackgroundColor := clMedGray; - bevLeft.BackgroundColor := clMedGray; - bevBottom.BackgroundColor := clMedGray; - bevRight.BackgroundColor := clMedGray; - Bevel2.BackgroundColor := clMedGray; - Bevel4.BackgroundColor := clMedGray; - end; + if FActive = AValue then + Exit; + FActive := AValue; + if FActive then + begin + Panel1.BackgroundColor := clNavy; + bevLeft.BackgroundColor := clNavy; + bevBottom.BackgroundColor := clNavy; + bevRight.BackgroundColor := clNavy; + Bevel2.BackgroundColor := clNavy; + Bevel4.BackgroundColor := clNavy; + end + else + begin + Panel1.BackgroundColor := clMedGray; + bevLeft.BackgroundColor := clMedGray; + bevBottom.BackgroundColor := clMedGray; + bevRight.BackgroundColor := clMedGray; + Bevel2.BackgroundColor := clMedGray; + Bevel4.BackgroundColor := clMedGray; + end; end; procedure TfpgMDIChildForm.ChildFormResized(Sender: TObject); @@ -192,215 +192,215 @@ end; procedure TfpgMDIChildForm.SetWindowTitle(AValue: TfpgString); begin - if FWindowTitle = AValue then - Exit; - FWindowTitle := AValue; - if not (csLoading in ComponentState) then - Panel1.Text := FWindowTitle; + if FWindowTitle = AValue then + Exit; + FWindowTitle := AValue; + if not (csLoading in ComponentState) then + Panel1.Text := FWindowTitle; end; constructor TfpgMDIChildForm.Create(AOwner: TfpgMDIWorkArea); begin - inherited Create(AOwner); - FMDIWorkArea := AOwner; - FIsMouseDown := False; - FLastPos := Point(0,0); - {@VFD_BODY_BEGIN: MDIChildForm} - Name := 'MDIChildForm'; - SetPosition(10, 10, 300, 250); - WindowTitle := 'ChildForm1'; - Hint := ''; + inherited Create(AOwner); + FMDIWorkArea := AOwner; + FIsMouseDown := False; + FLastPos := Point(0,0); + {@VFD_BODY_BEGIN: MDIChildForm} + Name := 'MDIChildForm'; + SetPosition(10, 10, 300, 250); + WindowTitle := 'ChildForm1'; + Hint := ''; OnResize := @ChildFormResized; - Panel1 := TfpgPanel.Create(self); - with Panel1 do - begin - Name := 'Panel1'; - SetPosition(0, 0, 301, 24); - Anchors := [anLeft,anRight,anTop]; - BackgroundColor := TfpgColor($0A0081); - FontDesc := '#Label2'; - Hint := ''; - Text := 'Window Title'; - TextColor := TfpgColor($FFFFFF); - OnMouseDown := @TitleMouseDown; - OnMouseUp := @TitleMouseUp; - OnMouseMove := @TitleMouseMove; - OnMouseExit := @TitleMouseExit; - end; - - bevLeft := TfpgBevel.Create(self); - with bevLeft do - begin - Name := 'bevLeft'; - SetPosition(0, 24, 3, 211); - Anchors := [anLeft,anTop,anBottom]; - BackgroundColor := TfpgColor($000080); - Hint := ''; - Shape := bsSpacer; - end; - - Bevel2 := TfpgBevel.Create(self); - with Bevel2 do - begin - Name := 'Bevel2'; - SetPosition(0, 235, 16, 16); - Anchors := [anLeft,anBottom]; - BackgroundColor := TfpgColor($000080); - Hint := ''; - end; - - bevBottom := TfpgBevel.Create(self); - with bevBottom do - begin - Name := 'bevBottom'; - SetPosition(16, 248, 269, 3); - Anchors := [anLeft,anRight,anBottom]; - BackgroundColor := TfpgColor($000080); - Hint := ''; - Shape := bsSpacer; - end; - - Bevel4 := TfpgBevel.Create(self); - with Bevel4 do - begin - Name := 'Bevel4'; - SetPosition(285, 235, 16, 16); - Anchors := [anRight,anBottom]; - BackgroundColor := TfpgColor($000080); - Hint := ''; - end; - - bevRight := TfpgBevel.Create(self); - with bevRight do - begin - Name := 'bevRight'; - SetPosition(297, 24, 3, 211); - Anchors := [anRight,anTop,anBottom]; - BackgroundColor := TfpgColor($000080); - Hint := ''; - Shape := bsSpacer; - end; - - Button1 := TfpgButton.Create(Panel1); - with Button1 do - begin - Name := 'Button1'; - SetPosition(3, 4, 16, 16); - Text := '-'; - Embedded := True; - FontDesc := '#Grid'; - Hint := ''; - ImageName := ''; - TabOrder := 1; - TextColor := TfpgColor($000000); - end; - - Button2 := TfpgButton.Create(Panel1); - with Button2 do - begin - Name := 'Button2'; - SetPosition(251, 4, 16, 16); - Anchors := [anRight,anTop]; - Text := '_'; - Embedded := True; - FontDesc := '#Grid'; - Hint := ''; - ImageName := ''; - TabOrder := 1; - TextColor := TfpgColor($000000); - end; - - Button3 := TfpgButton.Create(Panel1); - with Button3 do - begin - Name := 'Button3'; - SetPosition(267, 4, 16, 16); - Anchors := [anRight,anTop]; - Text := 'o'; - Embedded := True; - FontDesc := '#Grid'; - Hint := ''; - ImageName := ''; - TabOrder := 1; - TextColor := TfpgColor($000000); - end; - - Button4 := TfpgButton.Create(Panel1); - with Button4 do - begin - Name := 'Button4'; - SetPosition(283, 4, 16, 16); - Anchors := [anRight,anTop]; - Text := 'X'; - Embedded := True; - FontDesc := '#Grid'; - Hint := ''; - ImageName := ''; - TabOrder := 1; - TextColor := TfpgColor($000000); - OnClick := @CloseMDIWindowClicked; - end; - - bvlClientArea := TfpgBevel.Create(self); - with bvlClientArea do - begin - Name := 'bvlClientArea'; - SetPosition(2, 24, 296, 224); - Anchors := [anLeft,anRight,anTop,anBottom]; - Hint := ''; - Shape := bsSpacer; - end; - - {@VFD_BODY_END: MDIChildForm} - Name := 'MDIChildForm' + IntToStr(Random(MaxInt)); + Panel1 := TfpgPanel.Create(self); + with Panel1 do + begin + Name := 'Panel1'; + SetPosition(0, 0, 301, 24); + Anchors := [anLeft,anRight,anTop]; + BackgroundColor := TfpgColor($0A0081); + FontDesc := '#Label2'; + Hint := ''; + Text := 'Window Title'; + TextColor := TfpgColor($FFFFFF); + OnMouseDown := @TitleMouseDown; + OnMouseUp := @TitleMouseUp; + OnMouseMove := @TitleMouseMove; + OnMouseExit := @TitleMouseExit; + end; + + bevLeft := TfpgBevel.Create(self); + with bevLeft do + begin + Name := 'bevLeft'; + SetPosition(0, 24, 3, 211); + Anchors := [anLeft,anTop,anBottom]; + BackgroundColor := TfpgColor($000080); + Hint := ''; + Shape := bsSpacer; + end; + + Bevel2 := TfpgBevel.Create(self); + with Bevel2 do + begin + Name := 'Bevel2'; + SetPosition(0, 235, 16, 16); + Anchors := [anLeft,anBottom]; + BackgroundColor := TfpgColor($000080); + Hint := ''; + end; + + bevBottom := TfpgBevel.Create(self); + with bevBottom do + begin + Name := 'bevBottom'; + SetPosition(16, 248, 269, 3); + Anchors := [anLeft,anRight,anBottom]; + BackgroundColor := TfpgColor($000080); + Hint := ''; + Shape := bsSpacer; + end; + + Bevel4 := TfpgBevel.Create(self); + with Bevel4 do + begin + Name := 'Bevel4'; + SetPosition(285, 235, 16, 16); + Anchors := [anRight,anBottom]; + BackgroundColor := TfpgColor($000080); + Hint := ''; + end; + + bevRight := TfpgBevel.Create(self); + with bevRight do + begin + Name := 'bevRight'; + SetPosition(297, 24, 3, 211); + Anchors := [anRight,anTop,anBottom]; + BackgroundColor := TfpgColor($000080); + Hint := ''; + Shape := bsSpacer; + end; + + Button1 := TfpgButton.Create(Panel1); + with Button1 do + begin + Name := 'Button1'; + SetPosition(3, 4, 16, 16); + Text := '-'; + Embedded := True; + FontDesc := '#Grid'; + Hint := ''; + ImageName := ''; + TabOrder := 1; + TextColor := TfpgColor($000000); + end; + + Button2 := TfpgButton.Create(Panel1); + with Button2 do + begin + Name := 'Button2'; + SetPosition(251, 4, 16, 16); + Anchors := [anRight,anTop]; + Text := '_'; + Embedded := True; + FontDesc := '#Grid'; + Hint := ''; + ImageName := ''; + TabOrder := 1; + TextColor := TfpgColor($000000); + end; + + Button3 := TfpgButton.Create(Panel1); + with Button3 do + begin + Name := 'Button3'; + SetPosition(267, 4, 16, 16); + Anchors := [anRight,anTop]; + Text := 'o'; + Embedded := True; + FontDesc := '#Grid'; + Hint := ''; + ImageName := ''; + TabOrder := 1; + TextColor := TfpgColor($000000); + end; + + Button4 := TfpgButton.Create(Panel1); + with Button4 do + begin + Name := 'Button4'; + SetPosition(283, 4, 16, 16); + Anchors := [anRight,anTop]; + Text := 'X'; + Embedded := True; + FontDesc := '#Grid'; + Hint := ''; + ImageName := ''; + TabOrder := 1; + TextColor := TfpgColor($000000); + OnClick := @CloseMDIWindowClicked; + end; + + bvlClientArea := TfpgBevel.Create(self); + with bvlClientArea do + begin + Name := 'bvlClientArea'; + SetPosition(2, 24, 296, 224); + Anchors := [anLeft,anRight,anTop,anBottom]; + Hint := ''; + Shape := bsSpacer; + end; + + {@VFD_BODY_END: MDIChildForm} + Name := 'MDIChildForm' + IntToStr(Random(MaxInt)); end; procedure TfpgMDIChildForm.SetClientFrame(AFrame: TfpgFrame); begin -// AFrame.Owner := bvlClientArea; - AFrame.Align := alClient; - AFrame.Visible := True; - UpdateWindowTitle; +// AFrame.Owner := bvlClientArea; + AFrame.Align := alClient; + AFrame.Visible := True; + UpdateWindowTitle; end; procedure TfpgMDIChildForm.UpdateWindowTitle; begin - Panel1.Text := FWindowTitle; + Panel1.Text := FWindowTitle; end; procedure TfpgMDIChildForm.Close; begin - // We can't free ourselves, somebody else needs to do it - fpgPostMessage(Self, FMDIWorkArea, FPGM_FREEME); + // We can't free ourselves, somebody else needs to do it + fpgPostMessage(Self, FMDIWorkArea, FPGM_FREEME); end; { TfpgMDIWorkArea } procedure TfpgMDIWorkArea.InternalMsgFreeMe(var msg: TfpgMessageRec); var - i: integer; + i: integer; begin - if Assigned(msg.Sender) then - begin - if csDestroying in TComponent(msg.Sender).ComponentState then - Exit; - RemoveComponent(TfpgMDIChildForm(msg.Sender)); - i := FList.IndexOf(TfpgMDIChildForm(msg.Sender)); - if i = -1 then - raise Exception.Create('Could not find MDI Child Form'); - FList.Delete(i); - if FList.Count >= i+1 then - { set focus to next child window after the one just deleted } - ActiveWidget := TfpgMDIChildForm(FList.Items[i]) - else if FList.Count > 0 then - { fallback to the first child window we created } - ActiveWidget := TfpgMDIChildForm(FList.Items[0]) - else - { there simply isn't any more child windows } - ActiveWidget := nil; - TfpgMDIChildForm(msg.Sender).Free; - end; + if Assigned(msg.Sender) then + begin + if csDestroying in TComponent(msg.Sender).ComponentState then + Exit; + RemoveComponent(TfpgMDIChildForm(msg.Sender)); + i := FList.IndexOf(TfpgMDIChildForm(msg.Sender)); + if i = -1 then + raise Exception.Create('Could not find MDI Child Form'); + FList.Delete(i); + if FList.Count >= i+1 then + { set focus to next child window after the one just deleted } + ActiveWidget := TfpgMDIChildForm(FList.Items[i]) + else if FList.Count > 0 then + { fallback to the first child window we created } + ActiveWidget := TfpgMDIChildForm(FList.Items[0]) + else + { there simply isn't any more child windows } + ActiveWidget := nil; + TfpgMDIChildForm(msg.Sender).Free; + end; end; procedure TfpgMDIWorkArea.SetActiveWindow(AValue: TfpgMDIChildForm); @@ -408,21 +408,21 @@ var i: integer; w: TfpgMDIChildForm; begin - if FActiveWindow = AValue then - Exit; - FActiveWindow := AValue; - FActiveWindow.BringToFront; - ActiveWidget := FActiveWindow; - for i := 0 to FList.Count-1 do - begin - w := TfpgMDIChildForm(FList[i]); - w.Active := (w = AValue); - end; + if FActiveWindow = AValue then + Exit; + FActiveWindow := AValue; + FActiveWindow.BringToFront; + ActiveWidget := FActiveWindow; + for i := 0 to FList.Count-1 do + begin + w := TfpgMDIChildForm(FList[i]); + w.Active := (w = AValue); + end; end; function TfpgMDIWorkArea.GetChildWindowCount: integer; begin - Result := FList.Count; + Result := FList.Count; end; procedure TfpgMDIWorkArea.MDIChildMoved(Sender: TObject; const rec: TfpgMoveEventRec); @@ -497,8 +497,8 @@ end; procedure TfpgMDIWorkArea.HandlePaint; begin - inherited HandlePaint; - Canvas.Clear(clLtGray); + inherited HandlePaint; + Canvas.Clear(clLtGray); end; procedure TfpgMDIWorkArea.HandleResize(AWidth, AHeight: TfpgCoord); @@ -512,53 +512,53 @@ end; procedure TfpgMDIWorkArea.PositionScrollBars; begin - FHorBar.Left := Left; - FHorBar.Top := Height - FHorBar.Height; - FHorBar.Width := Width; - FHorBar.Anchors := [anLeft, anBottom, anRight]; - FVerBar.Left := Width - FVerBar.Width; - FVerBar.Top := 0; - FVerBar.Height := Height; - FVerBar.Anchors := [anRight, anTop, anBottom]; + FHorBar.Left := Left; + FHorBar.Top := Height - FHorBar.Height; + FHorBar.Width := Width; + FHorBar.Anchors := [anLeft, anBottom, anRight]; + FVerBar.Left := Width - FVerBar.Width; + FVerBar.Top := 0; + FVerBar.Height := Height; + FVerBar.Anchors := [anRight, anTop, anBottom]; end; constructor TfpgMDIWorkArea.Create(AOwner: TComponent); begin - inherited Create(AOwner); - FIsContainer := True; + inherited Create(AOwner); + FIsContainer := True; FScrollingHorizonal := False; FHorBar := TfpgScrollbar.Create(self); - FHorBar.Visible := False; - FHorBar.Orientation := orHorizontal; + FHorBar.Visible := False; + FHorBar.Orientation := orHorizontal; FHorBar.OnScroll := @HorizontalScrollBarScrolled; FVerBar := TfpgScrollbar.Create(self); - FVerBar.Visible := False; - FVerBar.Orientation := orVertical; + FVerBar.Visible := False; + FVerBar.Orientation := orVertical; PositionScrollBars; FList := TList.Create; - FActiveWindow := nil; + FActiveWindow := nil; end; destructor TfpgMDIWorkArea.Destroy; begin - FList.Free; - inherited Destroy; + FList.Free; + inherited Destroy; end; function TfpgMDIWorkArea.AddWindow(AWindowClass: TfpgFrameClass): TfpgFrame; var - frm: TfpgMDIChildForm; + frm: TfpgMDIChildForm; begin - frm := TfpgMDIChildForm.Create(self); - Result := AWindowClass.Create(frm.bvlClientArea); - frm.SetClientFrame(Result); + frm := TfpgMDIChildForm.Create(self); + Result := AWindowClass.Create(frm.bvlClientArea); + frm.SetClientFrame(Result); frm.OnMove := @MDIChildMoved; - FList.Add(frm); - ActiveWindow := frm; + FList.Add(frm); + ActiveWindow := frm; end; procedure TfpgMDIWorkArea.CascadeWindows; diff --git a/prototypes/mdi/frm_child.pas b/prototypes/mdi/frm_child.pas index 0d71b52d..acc61323 100644 --- a/prototypes/mdi/frm_child.pas +++ b/prototypes/mdi/frm_child.pas @@ -10,26 +10,26 @@ uses type - TChildForm = class(TfpgFrame) - private - {@VFD_HEAD_BEGIN: ChildForm} - btnClose: TfpgButton; - CheckBox1: TfpgCheckBox; - CheckBox2: TfpgCheckBox; - RadioButton1: TfpgRadioButton; - RadioButton2: TfpgRadioButton; - Edit1: TfpgEdit; - Gauge1: TfpgGauge; - TrackBar1: TfpgTrackBar; - {@VFD_HEAD_END: ChildForm} - FWindowTitle: TfpgString; - procedure btnCloseClicked(Sender: TObject); - procedure TrackBarChanged(Sender: TObject; APosition: integer); - procedure SetWindowTitle(const ATitle: TfpgString); reintroduce; - public - procedure AfterCreate; override; - property WindowTitle: TfpgString read FWindowTitle write SetWindowTitle; - end; + TChildForm = class(TfpgFrame) + private + {@VFD_HEAD_BEGIN: ChildForm} + btnClose: TfpgButton; + CheckBox1: TfpgCheckBox; + CheckBox2: TfpgCheckBox; + RadioButton1: TfpgRadioButton; + RadioButton2: TfpgRadioButton; + Edit1: TfpgEdit; + Gauge1: TfpgGauge; + TrackBar1: TfpgTrackBar; + {@VFD_HEAD_END: ChildForm} + FWindowTitle: TfpgString; + procedure btnCloseClicked(Sender: TObject); + procedure TrackBarChanged(Sender: TObject; APosition: integer); + procedure SetWindowTitle(const ATitle: TfpgString); reintroduce; + public + procedure AfterCreate; override; + property WindowTitle: TfpgString read FWindowTitle write SetWindowTitle; + end; {@VFD_NEWFORM_DECL} @@ -43,126 +43,126 @@ implementation procedure TChildForm.TrackBarChanged(Sender: TObject; APosition: integer); begin - Gauge1.Progress := APosition; + Gauge1.Progress := APosition; end; procedure TChildForm.SetWindowTitle(const ATitle: TfpgString); begin - if FWindowTitle = ATitle then - Exit; - FWindowTitle := ATitle; - TfpgMDIChildForm(Owner.Owner).WindowTitle := FWindowTitle; + if FWindowTitle = ATitle then + Exit; + FWindowTitle := ATitle; + TfpgMDIChildForm(Owner.Owner).WindowTitle := FWindowTitle; end; procedure TChildForm.btnCloseClicked(Sender: TObject); begin - TfpgMDIChildForm(Owner).Close; + TfpgMDIChildForm(Owner).Close; end; procedure TChildForm.AfterCreate; begin {%region 'Auto-generated GUI code' -fold} {@VFD_BODY_BEGIN: ChildForm} - Name := 'ChildForm'; - SetPosition(391, 210, 271, 150); -// WindowTitle := 'ChildForm'; - Hint := ''; - - btnClose := TfpgButton.Create(self); - with btnClose do - begin - Name := 'btnClose'; - SetPosition(180, 116, 80, 24); - Text := 'Close'; - FontDesc := '#Label1'; - Hint := ''; - ImageName := ''; - TabOrder := 1; - OnClick := @btnCloseClicked; - end; - - CheckBox1 := TfpgCheckBox.Create(self); - with CheckBox1 do - begin - Name := 'CheckBox1'; - SetPosition(164, 16, 120, 20); - FontDesc := '#Label1'; - Hint := ''; - TabOrder := 2; - Text := 'CheckBox'; - end; - - CheckBox2 := TfpgCheckBox.Create(self); - with CheckBox2 do - begin - Name := 'CheckBox2'; - SetPosition(164, 36, 120, 20); - FontDesc := '#Label1'; - Hint := ''; - TabOrder := 3; - Text := 'CheckBox'; - end; - - RadioButton1 := TfpgRadioButton.Create(self); - with RadioButton1 do - begin - Name := 'RadioButton1'; - SetPosition(164, 60, 120, 20); - FontDesc := '#Label1'; - GroupIndex := 0; - Hint := ''; - TabOrder := 4; - Text := 'RadioButton'; - end; - - RadioButton2 := TfpgRadioButton.Create(self); - with RadioButton2 do - begin - Name := 'RadioButton2'; - SetPosition(164, 80, 120, 20); - FontDesc := '#Label1'; - GroupIndex := 0; - Hint := ''; - TabOrder := 5; - Text := 'RadioButton'; - end; - - Edit1 := TfpgEdit.Create(self); - with Edit1 do - begin - Name := 'Edit1'; - SetPosition(8, 8, 120, 24); - ExtraHint := ''; - FontDesc := '#Edit1'; - Hint := ''; - TabOrder := 6; - Text := ''; - end; - - Gauge1 := TfpgGauge.Create(self); - with Gauge1 do - begin - Name := 'Gauge1'; - SetPosition(12, 44, 116, 25); - Color := TfpgColor($C4C4C4); - Hint := ''; - Progress := 65; - end; - - TrackBar1 := TfpgTrackBar.Create(self); - with TrackBar1 do - begin - Name := 'TrackBar1'; - SetPosition(12, 84, 116, 30); - Hint := ''; - TabOrder := 8; - Position := 65; - OnChange := @TrackBarChanged; - end; - - {@VFD_BODY_END: ChildForm} + Name := 'ChildForm'; + SetPosition(391, 210, 271, 150); +// WindowTitle := 'ChildForm'; + Hint := ''; + + btnClose := TfpgButton.Create(self); + with btnClose do + begin + Name := 'btnClose'; + SetPosition(180, 116, 80, 24); + Text := 'Close'; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 1; + OnClick := @btnCloseClicked; + end; + + CheckBox1 := TfpgCheckBox.Create(self); + with CheckBox1 do + begin + Name := 'CheckBox1'; + SetPosition(164, 16, 120, 20); + FontDesc := '#Label1'; + Hint := ''; + TabOrder := 2; + Text := 'CheckBox'; + end; + + CheckBox2 := TfpgCheckBox.Create(self); + with CheckBox2 do + begin + Name := 'CheckBox2'; + SetPosition(164, 36, 120, 20); + FontDesc := '#Label1'; + Hint := ''; + TabOrder := 3; + Text := 'CheckBox'; + end; + + RadioButton1 := TfpgRadioButton.Create(self); + with RadioButton1 do + begin + Name := 'RadioButton1'; + SetPosition(164, 60, 120, 20); + FontDesc := '#Label1'; + GroupIndex := 0; + Hint := ''; + TabOrder := 4; + Text := 'RadioButton'; + end; + + RadioButton2 := TfpgRadioButton.Create(self); + with RadioButton2 do + begin + Name := 'RadioButton2'; + SetPosition(164, 80, 120, 20); + FontDesc := '#Label1'; + GroupIndex := 0; + Hint := ''; + TabOrder := 5; + Text := 'RadioButton'; + end; + + Edit1 := TfpgEdit.Create(self); + with Edit1 do + begin + Name := 'Edit1'; + SetPosition(8, 8, 120, 24); + ExtraHint := ''; + FontDesc := '#Edit1'; + Hint := ''; + TabOrder := 6; + Text := ''; + end; + + Gauge1 := TfpgGauge.Create(self); + with Gauge1 do + begin + Name := 'Gauge1'; + SetPosition(12, 44, 116, 25); + Color := TfpgColor($C4C4C4); + Hint := ''; + Progress := 65; + end; + + TrackBar1 := TfpgTrackBar.Create(self); + with TrackBar1 do + begin + Name := 'TrackBar1'; + SetPosition(12, 84, 116, 30); + Hint := ''; + TabOrder := 8; + Position := 65; + OnChange := @TrackBarChanged; + end; + + {@VFD_BODY_END: ChildForm} {%endregion} - Name := 'ChildForm' + IntToStr(Random(MaxInt)); + Name := 'ChildForm' + IntToStr(Random(MaxInt)); end; diff --git a/prototypes/mdi/project1.lpr b/prototypes/mdi/project1.lpr index ea7cd3ca..63c0882c 100644 --- a/prototypes/mdi/project1.lpr +++ b/prototypes/mdi/project1.lpr @@ -12,20 +12,20 @@ uses type - TMainForm = class(TfpgForm) - private - {@VFD_HEAD_BEGIN: MainForm} + TMainForm = class(TfpgForm) + private + {@VFD_HEAD_BEGIN: MainForm} MainBar: TfpgMenuBar; MDIWorkArea: TfpgMDIWorkArea; Bevel1: TfpgBevel; pmChildren: TfpgPopupMenu; {@VFD_HEAD_END: MainForm} - procedure NewFormClicked(Sender: TObject); - procedure miQuitClicked(Sender: TObject); + procedure NewFormClicked(Sender: TObject); + procedure miQuitClicked(Sender: TObject); procedure miCascadeChildWindows(Sender: TObject); - public - procedure AfterCreate; override; - end; + public + procedure AfterCreate; override; + end; {@VFD_NEWFORM_DECL} @@ -35,13 +35,13 @@ type procedure TMainForm.NewFormClicked(Sender: TObject); begin - ChildForm := MDIWorkArea.AddWindow(TChildForm) as TChildForm; - ChildForm.WindowTitle := Format('Child %d', [MDIWorkArea.ChildWindowCount]); + ChildForm := MDIWorkArea.AddWindow(TChildForm) as TChildForm; + ChildForm.WindowTitle := Format('Child %d', [MDIWorkArea.ChildWindowCount]); end; procedure TMainForm.miQuitClicked(Sender: TObject); begin - Close; + Close; end; procedure TMainForm.miCascadeChildWindows(Sender: TObject); -- cgit v1.2.3-70-g09d2