diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-04-01 15:35:03 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-04-01 15:35:03 +0200 |
commit | 3c93212823f53b08f04f9f5e342ae3c8ca502a27 (patch) | |
tree | 28b2cab4be0d8401fb983cd1b308e1c12368a334 /src | |
parent | 7c7f1ebf9fbf02518e89446376a5c39c7b068a5c (diff) | |
download | fpGUI-3c93212823f53b08f04f9f5e342ae3c8ca502a27.tar.xz |
edit: Introduced a new property AutoSize.
If True (default), then the Height will be adjusted based on the
FontDesc being set.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/fpg_edit.pas | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/gui/fpg_edit.pas b/src/gui/fpg_edit.pas index 07bb49c9..ba5f16c2 100644 --- a/src/gui/fpg_edit.pas +++ b/src/gui/fpg_edit.pas @@ -56,6 +56,7 @@ type FSelecting: Boolean; FReadOnly: Boolean; FIgnoreMouseCursor: Boolean; + FAutoSize: Boolean; procedure Adjust(UsePxCursorPos: boolean = false); virtual; procedure AdjustTextOffset(UsePxCursorPos: boolean); virtual; procedure AdjustDrawingInfo; virtual; @@ -112,6 +113,7 @@ type procedure HandleHide; override; function GetDrawText: String; property AutoSelect: Boolean read FAutoSelect write SetAutoSelect default True; + property AutoSize: Boolean read FAutoSize write FAutoSize default True; property BorderStyle: TfpgEditBorderStyle read FBorderStyle write SetBorderStyle default ebsDefault; property FontDesc: String read GetFontDesc write SetFontDesc; property HideSelection: Boolean read FHideSelection write SetHideSelection default True; @@ -157,6 +159,7 @@ type property PopupMenu; // UI Designer doesn't fully support it yet published property AutoSelect; + property AutoSize; property BackgroundColor default clBoxColor; property BorderStyle; property ExtraHint; @@ -1014,6 +1017,7 @@ begin FTextColor := Parent.TextColor; FBackgroundColor := clBoxColor; FAutoSelect := True; + FAutoSize := True; FSelecting := False; FHideSelection := True; FReadOnly := False; @@ -1074,16 +1078,19 @@ procedure TfpgBaseEdit.SetFontDesc(const AValue: string); begin FFont.Free; FFont := fpgGetFont(AValue); - case BorderStyle of - ebsNone: - if Height < FFont.Height + (FHeightMargin * 2) then - Height:= FFont.Height + (FHeightMargin * 2); - ebsDefault: - if Height < FFont.Height + 4 + (FHeightMargin * 2) then - Height:= FFont.Height + 4 + (FHeightMargin * 2); - ebsSingle: - if Height < FFont.Height + 2 + (FHeightMargin * 2) then - Height:= FFont.Height + 2 + (FHeightMargin * 2); + if AutoSize then + begin + case BorderStyle of + ebsNone: + if Height < FFont.Height + (FHeightMargin * 2) then + Height:= FFont.Height + (FHeightMargin * 2); + ebsDefault: + if Height < FFont.Height + 4 + (FHeightMargin * 2) then + Height:= FFont.Height + 4 + (FHeightMargin * 2); + ebsSingle: + if Height < FFont.Height + 2 + (FHeightMargin * 2) then + Height:= FFont.Height + 2 + (FHeightMargin * 2); + end; end; Adjust; RePaint; |