diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-11-12 15:35:23 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-11-12 15:35:23 +0200 |
commit | d982b1f93c1af52552cc8d1e6e1665d3770d8f07 (patch) | |
tree | 29b9ab279b329076075167aca03c6c6c39c17dbc /src | |
parent | e4e8a21acc3695683da146777d5382aea9624995 (diff) | |
download | fpGUI-d982b1f93c1af52552cc8d1e6e1665d3770d8f07.tar.xz |
Edit widget: changed AutoSize default to False
* This was done in preperation for layout managers which will
control widget sizes, and AutoSize will just interfere.
* Default Height is now set at 24px (same as what it was before
with default Arial font)
* Also implementeted setter for AutoSize property. This now
correctly adjusts the widget set when the property is changed
to True.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/fpg_edit.pas | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/gui/fpg_edit.pas b/src/gui/fpg_edit.pas index da98224c..6962a80a 100644 --- a/src/gui/fpg_edit.pas +++ b/src/gui/fpg_edit.pas @@ -80,6 +80,7 @@ type procedure DefaultPopupInsertFromCharmap(Sender: TObject); procedure SetDefaultPopupMenuItemsState; procedure SetReadOnly(const AValue: Boolean); + procedure SetAutoSize(const AValue: Boolean); protected FFont: TfpgFont; FSideMargin: integer; @@ -114,7 +115,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 AutoSize: Boolean read FAutoSize write SetAutoSize default False; 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; @@ -1025,12 +1026,12 @@ begin inherited Create(AOwner); FFont := fpgGetFont('#Edit1'); // owned object ! Focusable := True; - FHeight := FFont.Height + 8; // (BorderStyle + HeightMargin) * 2 + FHeight := 24; FWidth := 120; FTextColor := Parent.TextColor; FBackgroundColor := clBoxColor; FAutoSelect := True; - FAutoSize := True; + FAutoSize := False; FSelecting := False; FHideSelection := True; FReadOnly := False; @@ -1236,6 +1237,21 @@ begin RePaint; end; +procedure TfpgBaseEdit.SetAutoSize(const AValue: Boolean); +var + r: TRect; +begin + if FAutoSize = AValue then + exit; + FAutoSize := AValue; + if FAutoSize then + begin + r := fpgStyle.GetControlFrameBorders; + FHeight := FFont.Height + (FHeightMargin*2) + (r.Top+r.Bottom); + UpdateWindowPosition; + end; +end; + function TfpgBaseEdit.GetMarginAdjustment: integer; begin Result := FSideMargin; |