mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-24 00:27:06 +02:00
LCL: Password masking in InputQuery for Delphi compatibility. Issue #33370, patch from Denis Grinyuk.
git-svn-id: trunk@58949 -
This commit is contained in:
parent
80b6f0a6cc
commit
f7ff9f786d
@ -385,6 +385,22 @@ var
|
||||
FButtons: TButtonPanel;
|
||||
FForm: TDummyForInput;
|
||||
Len, NSpacing, NEditWidth, i: integer;
|
||||
|
||||
function GetPromptCaption(const APrompt: string): string;
|
||||
begin
|
||||
Result:= APrompt;
|
||||
if (Result<>'') and (Result[1]<' ') then
|
||||
Delete(Result, 1, 1);
|
||||
end;
|
||||
|
||||
function GetPasswordChar(const APrompt: string): Char;
|
||||
begin
|
||||
if (APrompt<>'') and (APrompt[1]<' ') then
|
||||
Result := '*'
|
||||
else
|
||||
Result := #0;
|
||||
end;
|
||||
|
||||
begin
|
||||
Result:= false;
|
||||
if Length(APrompts)<1 then
|
||||
@ -436,6 +452,8 @@ begin
|
||||
FEdits[i].Align:= alRight;
|
||||
FEdits[i].Width:= NEditWidth;
|
||||
FEdits[i].Text:= AValues[i];
|
||||
if i<Length(APrompts) then
|
||||
FEdits[i].PasswordChar:= GetPasswordChar(APrompts[i]);
|
||||
|
||||
FLabels[i]:= TPanel.Create(FForm);
|
||||
FLabels[i].Parent:= FPanels[i];
|
||||
@ -443,7 +461,7 @@ begin
|
||||
FLabels[i].BevelInner:= bvNone;
|
||||
FLabels[i].BevelOuter:= bvNone;
|
||||
if i<Length(APrompts) then
|
||||
FLabels[i].Caption:= APrompts[i];
|
||||
FLabels[i].Caption:= GetPromptCaption(APrompts[i]);
|
||||
FLabels[i].BorderSpacing.Right:= NSpacing;
|
||||
FLabels[i].Width:= FLabels[i].Canvas.TextWidth(FLabels[i].Caption);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user