mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-03 15:21:18 +02:00
LCL: tried to fix EchoMode and PasswordChar (bug #7924)
git-svn-id: trunk@10310 -
This commit is contained in:
parent
75f42392b4
commit
fcef497c0f
@ -274,9 +274,14 @@ end;
|
||||
procedure TCustomEdit.SetPasswordChar(const AValue: Char);
|
||||
begin
|
||||
if FPasswordChar=AValue then exit;
|
||||
|
||||
FPasswordChar:=AValue;
|
||||
if FPasswordChar=#0 then
|
||||
EchoMode:=emNormal;
|
||||
case FPasswordChar of
|
||||
#0: EchoMode := emNormal;
|
||||
' ': EchoMode := emNone;
|
||||
else
|
||||
EchoMode:=emPassword;
|
||||
end;
|
||||
if HandleAllocated then
|
||||
TWSCustomEditClass(WidgetSetClass).SetPasswordChar(Self, AValue);
|
||||
end;
|
||||
@ -288,11 +293,20 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCustomEdit.SetEchoMode(Val : TEchoMode);
|
||||
begin
|
||||
if (Val <> FEchoMode) then begin
|
||||
FEchoMode:= Val;
|
||||
if HandleAllocated then
|
||||
TWSCustomEditClass(WidgetSetClass).SetEchoMode(Self, Val);
|
||||
if FEchoMode=Val then exit;
|
||||
|
||||
FEchoMode:= Val;
|
||||
case FEchoMode of
|
||||
emNormal :
|
||||
PasswordChar := #0;
|
||||
emPassWord :
|
||||
if (PasswordChar=#0) or (PasswordChar=' ')
|
||||
then PasswordChar := '*';
|
||||
emNone :
|
||||
PasswordChar := ' ';
|
||||
end;
|
||||
if HandleAllocated then
|
||||
TWSCustomEditClass(WidgetSetClass).SetEchoMode(Self, Val);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -858,10 +858,8 @@ begin
|
||||
end;
|
||||
|
||||
class procedure TWin32WSCustomEdit.SetEchoMode(const ACustomEdit: TCustomEdit; NewMode: TEchoMode);
|
||||
const
|
||||
PassWordChar : array[TEchoMode] of char = (#0, ' ','*');
|
||||
begin
|
||||
ACustomEdit.PasswordChar := PassWordChar[NewMode];
|
||||
// nothing to do, SetPasswordChar will do the work
|
||||
end;
|
||||
|
||||
class procedure TWin32WSCustomEdit.SetMaxLength(const ACustomEdit: TCustomEdit; NewLength: integer);
|
||||
|
Loading…
Reference in New Issue
Block a user