diff --git a/lcl/include/customedit.inc b/lcl/include/customedit.inc index 9577663557..97d6f6f9ef 100644 --- a/lcl/include/customedit.inc +++ b/lcl/include/customedit.inc @@ -362,9 +362,21 @@ begin FModified := Value; end; +function TCustomEdit.GetPasswordChar: Char; +begin + if FTextHintShowing then + Result := FSavedPasswordChar + else + Result := FPasswordChar; +end; procedure TCustomEdit.SetPasswordChar(const AValue: Char); begin + if FTextHintShowing and (not FSettingTextHint) and (FSavedPasswordChar<>AValue) then + begin + FSavedPasswordChar := AValue; + Exit; + end; if FPasswordChar=AValue then exit; FPasswordChar:=AValue; @@ -642,6 +654,7 @@ begin FSavedFontColor := Font.Color; FSavedFontStyle := Font.Style; FSavedParentFont := ParentFont; + FSavedPasswordChar := PasswordChar; end; FTextHintShowing := True; OldModified := Modified; @@ -651,6 +664,7 @@ begin inherited RealSetText(FTextHint); Font.Color := FTextHintFontColor; Font.Style := FTextHintFontStyle; + PasswordChar := #0; finally FSettingTextHint := False; Modified := OldModified; @@ -667,6 +681,7 @@ begin Font.Color := FSavedFontColor; Font.Style := FSavedFontStyle; ParentFont := FSavedParentFont; + PasswordChar := FSavedPasswordChar; FTextHintShowing := False; FSettingTextHint := True; inherited RealSetText(''); diff --git a/lcl/stdctrls.pp b/lcl/stdctrls.pp index 49a2f9a11b..3bd3c95334 100644 --- a/lcl/stdctrls.pp +++ b/lcl/stdctrls.pp @@ -715,6 +715,7 @@ type FSavedFontColor: TColor; FSavedFontStyle: TFontStyles; FSavedParentFont: Boolean; + FSavedPasswordChar: Char; procedure SetTextHint(AValue: TTranslateString); procedure ShowTextHint; procedure HideTextHint; @@ -725,6 +726,7 @@ type procedure SetHideSelection(const AValue: Boolean); procedure SetMaxLength(Value: Integer); procedure SetModified(Value: Boolean); + function GetPasswordChar: Char; procedure SetPasswordChar(const AValue: Char); protected class procedure WSRegisterClass; override; @@ -785,7 +787,7 @@ type property Modified: Boolean read GetModified write SetModified; property NumbersOnly: Boolean read GetNumbersOnly write SetNumbersOnly default false; property OnChange: TNotifyEvent read FOnChange write FOnChange; - property PasswordChar: Char read FPasswordChar write SetPasswordChar default #0; + property PasswordChar: Char read GetPasswordChar write SetPasswordChar default #0; property PopupMenu; property ReadOnly: Boolean read GetReadOnly write SetReadOnly default false; property SelLength: integer read GetSelLength write SetSelLength;