From 2759e11c0f5674184afbf29f7abd5799884ba813 Mon Sep 17 00:00:00 2001 From: graemeg Date: Mon, 16 Feb 2009 07:37:08 +0000 Subject: Reverted the previous vista hint implementation. Introduced a new ExtraHint property which is separate from the Hint property. --- src/corelib/fpg_main.pas | 2 ++ src/gui/fpg_combobox.pas | 15 ++++++++++++++- src/gui/fpg_edit.pas | 23 ++++++++++++++++++++++- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/corelib/fpg_main.pas b/src/corelib/fpg_main.pas index c4d3657a..3855b30d 100644 --- a/src/corelib/fpg_main.pas +++ b/src/corelib/fpg_main.pas @@ -1712,6 +1712,8 @@ end; procedure TfpgStyle.DrawString(ACanvas: TfpgCanvas; x, y: TfpgCoord; AText: string; AEnabled: boolean); begin + if AText = '' then + Exit; //==> if not AEnabled then begin ACanvas.SetTextColor(clHilite1); diff --git a/src/gui/fpg_combobox.pas b/src/gui/fpg_combobox.pas index b014e1d6..8de11146 100644 --- a/src/gui/fpg_combobox.pas +++ b/src/gui/fpg_combobox.pas @@ -108,7 +108,9 @@ type TfpgBaseStaticCombo = class(TfpgBaseComboBox) private + FExtraHint: string; procedure InternalBtnClick(Sender: TObject); + procedure SetExtraHint(const AValue: string); protected FDropDown: TfpgPopupWindow; procedure DoDropDown; override; @@ -122,6 +124,7 @@ type procedure HandleMouseScroll(x, y: integer; shiftstate: TShiftState; delta: smallint); override; procedure HandlePaint; override; property Text: string read GetText write SetText; + property ExtraHint: string read FExtraHint write SetExtraHint; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; @@ -133,6 +136,7 @@ type published property BackgroundColor default clBoxColor; property DropDownCount; + property ExtraHint; property FocusItem; property FontDesc; property Height; @@ -539,6 +543,14 @@ begin DoDropDown; end; +procedure TfpgBaseStaticCombo.SetExtraHint(const AValue: string); +begin + if FExtraHint = AValue then + Exit; //==> + FExtraHint := AValue; + Repaint; +end; + procedure TfpgBaseStaticCombo.SetText(const AValue: string); var i: integer; @@ -664,7 +676,7 @@ begin else begin Canvas.SetTextColor(clShadow1); - fpgStyle.DrawString(Canvas, FMargin+1, FMargin, Hint, Enabled); + fpgStyle.DrawString(Canvas, FMargin+1, FMargin, ExtraHint, Enabled); end; end; @@ -676,6 +688,7 @@ begin FWidth := 120; FHeight := Font.Height + (2*FMargin); FFocusable := True; + FExtraHint := ''; CalculateInternalButtonRect; end; diff --git a/src/gui/fpg_edit.pas b/src/gui/fpg_edit.pas index 03ddf4de..9a653422 100644 --- a/src/gui/fpg_edit.pas +++ b/src/gui/fpg_edit.pas @@ -124,8 +124,14 @@ type TfpgBaseTextEdit = class(TfpgBaseEdit) + private + FExtraHint: string; + procedure SetExtraHint(const AValue: string); protected procedure HandlePaint; override; + property ExtraHint: string read FExtraHint write SetExtraHint; + public + constructor Create(AOwner: TComponent); override; end; @@ -136,6 +142,7 @@ type property AutoSelect; property BackgroundColor default clBoxColor; property BorderStyle; + property ExtraHint; property FontDesc; property HeightMargin; property HideSelection; @@ -1293,7 +1300,7 @@ begin if (FVisibleText = '') and not Focused then begin Canvas.SetTextColor(clShadow1); - fpgStyle.DrawString(Canvas, -FDrawOffset + GetMarginAdjustment, r.Top + FHeightMargin, FHint, Enabled); + fpgStyle.DrawString(Canvas, -FDrawOffset + GetMarginAdjustment, r.Top + FHeightMargin, FExtraHint, Enabled); end else begin @@ -1320,6 +1327,20 @@ begin end; +constructor TfpgBaseTextEdit.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FExtraHint := ''; +end; + +procedure TfpgBaseTextEdit.SetExtraHint(const AValue: string); +begin + if FExtraHint = AValue then + Exit; //==> + FExtraHint := AValue; + Repaint; +end; + { TfpgBaseNumericEdit } procedure TfpgBaseNumericEdit.AdjustTextOffset(UsePxCursorPos: boolean); -- cgit v1.2.3-70-g09d2