diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2011-04-23 10:16:27 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2011-04-23 10:16:27 +0200 |
commit | 7023d6484881eb50d872160765c2ffc8ce1c2602 (patch) | |
tree | a4ba14e05301fb8b27ff9a03ce870b26ee3ae625 | |
parent | e1baa176d5d5b974c585fa7960ad5f8aeb19b7e4 (diff) | |
download | fpGUI-7023d6484881eb50d872160765c2ffc8ce1c2602.tar.xz |
minor TfpgEditButton improvements when used inside the UI Designer.
-rw-r--r-- | src/gui/fpg_editbtn.pas | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/gui/fpg_editbtn.pas b/src/gui/fpg_editbtn.pas index 5167b393..dd7331e9 100644 --- a/src/gui/fpg_editbtn.pas +++ b/src/gui/fpg_editbtn.pas @@ -130,6 +130,7 @@ type protected function GetText: TfpgString; procedure SetText(const AValue: TfpgString); + procedure HandlePaint; override; public constructor Create(AOwner: TComponent); override; published @@ -164,6 +165,36 @@ begin FEdit.Text := AValue; end; +procedure TfpgEditButton.HandlePaint; +var + img: TfpgImage; +begin + inherited HandlePaint; + // only so that it looks pretty in the UI Designer + if csDesigning in ComponentState then + begin + FEdit.Visible := False; + FButton.Visible := False; + Canvas.Clear(clBoxColor); + fpgStyle.DrawControlFrame(Canvas, 0, 0, Width - Height, Height); + fpgStyle.DrawButtonFace(Canvas, Width - Height, 0, Height, Height, [btfIsEmbedded]); + Canvas.SetFont(fpgApplication.DefaultFont); + if Text <> '' then + begin + Canvas.TextColor := clText3; + Canvas.DrawText(4, 0, Width - Height, Height, Text, [txtLeft, txtVCenter]); + end + else + begin + Canvas.TextColor := clShadow1; + Canvas.DrawText(0, 0, Width - Height, Height, ClassName, [txtHCenter, txtVCenter]); + end; + img := fpgImages.GetImage('stdimg.ellipse'); // don't free the img instance - we only got a reference + if img <> nil then + Canvas.DrawImage(Width-Height+((Height-img.Width) div 2), (Height-img.Height) div 2, img); + end; +end; + constructor TfpgEditButton.Create(AOwner: TComponent); begin inherited Create(AOwner); |