-
-
Notifications
You must be signed in to change notification settings - Fork 966
/
Copy pathPasswordEdit.pas
106 lines (92 loc) · 2.22 KB
/
PasswordEdit.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
unit PasswordEdit;
{
Inno Setup
Copyright (C) 1997-2018 Jordan Russell
Portions by Martijn Laan
For conditions of distribution and use, see LICENSE.TXT.
This unit provides a true password edit.
}
interface
uses
Windows, Classes, Controls, StdCtrls;
type
TPasswordEdit = class(TCustomEdit)
private
FPassword: Boolean;
procedure SetPassword(Value: Boolean);
protected
procedure CreateParams(var Params: TCreateParams); override;
public
constructor Create(AOwner: TComponent); override;
published
property Anchors;
property AutoSelect;
property AutoSize;
property BorderStyle;
property CharCase;
property Color;
property Ctl3D;
property DragCursor;
property DragMode;
property Enabled;
property Font;
property HideSelection;
property MaxLength;
property OEMConvert;
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property Password: Boolean read FPassword write SetPassword default True;
property PopupMenu;
property ReadOnly;
property ShowHint;
property TabOrder;
property TabStop;
property Text;
property Visible;
property OnChange;
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnStartDrag;
end;
procedure Register;
implementation
uses
BidiUtils;
procedure Register;
begin
RegisterComponents('JR', [TPasswordEdit]);
end;
{ TPasswordEdit }
constructor TPasswordEdit.Create(AOwner: TComponent);
begin
inherited;
FPassword := True;
end;
procedure TPasswordEdit.CreateParams(var Params: TCreateParams);
begin
inherited;
if FPassword then
Params.Style := Params.Style or ES_PASSWORD;
SetBiDiStyles(Self, Params);
end;
procedure TPasswordEdit.SetPassword(Value: Boolean);
begin
if FPassword <> Value then begin
FPassword := Value;
RecreateWnd;
end;
end;
end.