View Issue Details

IDProjectCategoryView StatusLast Update
0029748LazarusLCLpublic2016-02-28 14:57
ReporterNur Cholif MurtadhoAssigned ToBart Broersma 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product VersionProduct Build 
Target Version1.6Fixed in Version1.6 
Summary0029748: TEdit, texthint show password char instead of real text
DescriptionIsn't text hint should be showed as real text instead of password char on TEdit?
TagsNo tags attached.
Fixed in Revisionr51742
LazTarget1.6
Widgetset
Attached Files
  • tcustomedit.patch (2,780 bytes)
    Index: lcl/include/customedit.inc
    ===================================================================
    --- lcl/include/customedit.inc	(revision 51734)
    +++ lcl/include/customedit.inc	(working copy)
    @@ -362,9 +362,21 @@
       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 @@
         FSavedFontColor := Font.Color;
         FSavedFontStyle := Font.Style;
         FSavedParentFont := ParentFont;
    +    FSavedPasswordChar := PasswordChar;
       end;
       FTextHintShowing := True;
       OldModified := Modified;
    @@ -651,6 +664,7 @@
         inherited RealSetText(FTextHint);
         Font.Color := FTextHintFontColor;
         Font.Style := FTextHintFontStyle;
    +    PasswordChar := #0;
       finally
         FSettingTextHint := False;
         Modified := OldModified;
    @@ -667,6 +681,7 @@
         Font.Color := FSavedFontColor;
         Font.Style := FSavedFontStyle;
         ParentFont := FSavedParentFont;
    +    PasswordChar := FSavedPasswordChar;
         FTextHintShowing := False;
         FSettingTextHint := True;
         inherited RealSetText('');
    Index: lcl/stdctrls.pp
    ===================================================================
    --- lcl/stdctrls.pp	(revision 51734)
    +++ lcl/stdctrls.pp	(working copy)
    @@ -715,6 +715,7 @@
         FSavedFontColor: TColor;
         FSavedFontStyle: TFontStyles;
         FSavedParentFont: Boolean;
    +    FSavedPasswordChar: Char;
         procedure SetTextHint(AValue: TTranslateString);
         procedure ShowTextHint;
         procedure HideTextHint;
    @@ -725,6 +726,7 @@
         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 @@
         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;
    
    tcustomedit.patch (2,780 bytes)

Activities

Nur Cholif Murtadho

2016-02-28 07:20

reporter  

tcustomedit.patch (2,780 bytes)
Index: lcl/include/customedit.inc
===================================================================
--- lcl/include/customedit.inc	(revision 51734)
+++ lcl/include/customedit.inc	(working copy)
@@ -362,9 +362,21 @@
   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 @@
     FSavedFontColor := Font.Color;
     FSavedFontStyle := Font.Style;
     FSavedParentFont := ParentFont;
+    FSavedPasswordChar := PasswordChar;
   end;
   FTextHintShowing := True;
   OldModified := Modified;
@@ -651,6 +664,7 @@
     inherited RealSetText(FTextHint);
     Font.Color := FTextHintFontColor;
     Font.Style := FTextHintFontStyle;
+    PasswordChar := #0;
   finally
     FSettingTextHint := False;
     Modified := OldModified;
@@ -667,6 +681,7 @@
     Font.Color := FSavedFontColor;
     Font.Style := FSavedFontStyle;
     ParentFont := FSavedParentFont;
+    PasswordChar := FSavedPasswordChar;
     FTextHintShowing := False;
     FSettingTextHint := True;
     inherited RealSetText('');
Index: lcl/stdctrls.pp
===================================================================
--- lcl/stdctrls.pp	(revision 51734)
+++ lcl/stdctrls.pp	(working copy)
@@ -715,6 +715,7 @@
     FSavedFontColor: TColor;
     FSavedFontStyle: TFontStyles;
     FSavedParentFont: Boolean;
+    FSavedPasswordChar: Char;
     procedure SetTextHint(AValue: TTranslateString);
     procedure ShowTextHint;
     procedure HideTextHint;
@@ -725,6 +726,7 @@
     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 @@
     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;
tcustomedit.patch (2,780 bytes)

Bart Broersma

2016-02-28 10:53

developer   ~0090436

Patch applied.
Well spotted.
Please close if OK.

Nur Cholif Murtadho

2016-02-28 14:57

reporter   ~0090445

Thanks

Issue History

Date Modified Username Field Change
2016-02-28 03:14 Nur Cholif Murtadho New Issue
2016-02-28 07:20 Nur Cholif Murtadho File Added: tcustomedit.patch
2016-02-28 10:24 Bart Broersma Assigned To => Bart Broersma
2016-02-28 10:24 Bart Broersma Status new => assigned
2016-02-28 10:53 Bart Broersma Fixed in Revision => r51742
2016-02-28 10:53 Bart Broersma LazTarget => 1.6
2016-02-28 10:53 Bart Broersma Note Added: 0090436
2016-02-28 10:53 Bart Broersma Status assigned => resolved
2016-02-28 10:53 Bart Broersma Fixed in Version => 1.6
2016-02-28 10:53 Bart Broersma Resolution open => fixed
2016-02-28 10:53 Bart Broersma Target Version => 1.6
2016-02-28 14:57 Nur Cholif Murtadho Note Added: 0090445
2016-02-28 14:57 Nur Cholif Murtadho Status resolved => closed