diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-04-30 15:23:24 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-04-30 15:23:24 +0200 |
commit | 100aa19f20291d7f4090f126b1f86b07d2299b2b (patch) | |
tree | 9bd3f45ed2eb4ef5a6babd1c90e882fb0f596de0 /examples | |
parent | d3406a5508115b841a8497bcd5cdfe81a81cebf5 (diff) | |
download | fpGUI-100aa19f20291d7f4090f126b1f86b07d2299b2b.tar.xz |
Canvas Test demo: now the form is managed by the UI Designer.
Also refactored the code to fit the normal GUI design standards.
eg: using Create() and Destroy() etc..
Diffstat (limited to 'examples')
-rw-r--r-- | examples/corelib/canvastest/fpgcanvas.lpi | 6 | ||||
-rw-r--r-- | examples/corelib/canvastest/fpgcanvas.lpr | 57 |
2 files changed, 32 insertions, 31 deletions
diff --git a/examples/corelib/canvastest/fpgcanvas.lpi b/examples/corelib/canvastest/fpgcanvas.lpi index 66833b5b..577a2a8f 100644 --- a/examples/corelib/canvastest/fpgcanvas.lpi +++ b/examples/corelib/canvastest/fpgcanvas.lpi @@ -5,12 +5,13 @@ <General> <Flags> <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> <LRSInOutputDirectory Value="False"/> </Flags> <SessionStorage Value="InProjectDir"/> <MainUnit Value="0"/> <TargetFileExt Value=""/> - <Title Value="fpcanvas"/> </General> <VersionInfo> <ProjectVersion Value=""/> @@ -45,6 +46,9 @@ <SmartLinkUnit Value="True"/> </CodeGeneration> <Linking> + <Debugging> + <UseLineInfoUnit Value="False"/> + </Debugging> <LinkSmart Value="True"/> </Linking> <Other> diff --git a/examples/corelib/canvastest/fpgcanvas.lpr b/examples/corelib/canvastest/fpgcanvas.lpr index c5473ba9..c774a156 100644 --- a/examples/corelib/canvastest/fpgcanvas.lpr +++ b/examples/corelib/canvastest/fpgcanvas.lpr @@ -15,20 +15,18 @@ uses type - { TMainForm } - TMainForm = class(TfpgForm) private + {@VFD_HEAD_BEGIN: MainForm} + {@VFD_HEAD_END: MainForm} bmp: TfpgImage; dst: TfpgImage; - procedure FormPaint(Sender: TObject); - procedure CustomPaintJob; - protected - procedure HandlePaint; override; + procedure FormPaint(Sender: TObject); + procedure CustomPaintJob; public - procedure AfterCreate; override; - procedure AfterConstruction; override; - procedure BeforeDestruction; override; + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure AfterCreate; override; end; { TMainForm } @@ -186,47 +184,46 @@ begin // Gradient testing r.SetRect(265, 340, 185, 35); Canvas.GradientFill(r, clBlue, clMagenta, gdHorizontal); - -end; - -procedure TMainForm.HandlePaint; -begin - inherited HandlePaint; -// CustomPaintJob; end; -procedure TMainForm.AfterCreate; +constructor TMainForm.Create(AOwner: TComponent); begin - inherited AfterCreate; - SetPosition(100, 100, 500, 400); - WindowTitle := 'fpGFX Canvas Test'; + inherited Create(AOwner); bmp := LoadImage_BMP('button.bmp'); if not Assigned(bmp) then raise Exception.Create('Failed to load button.bmp'); bmp.CreateMaskFromSample(0,0); bmp.UpdateImage; - -// dst := TfpgImage.Create; -// dst.AllocateImage(bmp.ColorDepth, 200, 50); + dst := LoadImage_BMP('gears2.bmp'); dst.CreateMaskFromSample(0,0); dst.UpdateImage; end; -procedure TMainForm.AfterConstruction; +destructor TMainForm.Destroy; begin - inherited AfterConstruction; - OnPaint := @FormPaint; + dst.Free; + bmp.Free; + inherited Destroy; end; -procedure TMainForm.BeforeDestruction; +procedure TMainForm.AfterCreate; begin - dst.Free; - bmp.Free; - inherited BeforeDestruction; + {%region 'Auto-generated GUI code' -fold} + {@VFD_BODY_BEGIN: MainForm} + Name := 'MainForm'; + SetPosition(357, 214, 500, 400); + WindowTitle := 'fpGUI Canvas Test'; + Hint := ''; + WindowPosition := wpOneThirdDown; + OnPaint := @FormPaint; + + {@VFD_BODY_END: MainForm} + {%endregion} end; + procedure MainProc; var frm: TMainForm; |