mirror of
				https://gitlab.com/freepascal.org/lazarus/lazarus.git
				synced 2025-10-31 06:21:38 +01: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); | procedure TCustomEdit.SetPasswordChar(const AValue: Char); | ||||||
| begin | begin | ||||||
|   if FPasswordChar=AValue then exit; |   if FPasswordChar=AValue then exit; | ||||||
|  | 
 | ||||||
|   FPasswordChar:=AValue; |   FPasswordChar:=AValue; | ||||||
|   if FPasswordChar=#0 then
 |   case FPasswordChar of | ||||||
|     EchoMode:=emNormal; |     #0: EchoMode := emNormal;
 | ||||||
|  |     ' ': EchoMode := emNone; | ||||||
|  |   else | ||||||
|  |     EchoMode:=emPassword; | ||||||
|  |   end; | ||||||
|   if HandleAllocated then |   if HandleAllocated then | ||||||
|     TWSCustomEditClass(WidgetSetClass).SetPasswordChar(Self, AValue); |     TWSCustomEditClass(WidgetSetClass).SetPasswordChar(Self, AValue); | ||||||
| end; | end; | ||||||
| @ -288,11 +293,20 @@ end; | |||||||
|  ------------------------------------------------------------------------------} |  ------------------------------------------------------------------------------} | ||||||
| procedure TCustomEdit.SetEchoMode(Val : TEchoMode); | procedure TCustomEdit.SetEchoMode(Val : TEchoMode); | ||||||
| begin | begin | ||||||
|   if (Val <> FEchoMode) then begin |   if FEchoMode=Val then exit; | ||||||
|     FEchoMode:= Val; |    | ||||||
|     if HandleAllocated then |   FEchoMode:= Val; | ||||||
|       TWSCustomEditClass(WidgetSetClass).SetEchoMode(Self, Val); |   case FEchoMode of | ||||||
|  |     emNormal : | ||||||
|  |       PasswordChar := #0;
 | ||||||
|  |     emPassWord : | ||||||
|  |       if (PasswordChar=#0) or (PasswordChar=' ')
 | ||||||
|  |         then PasswordChar := '*'; | ||||||
|  |     emNone : | ||||||
|  |       PasswordChar := ' '; | ||||||
|   end; |   end; | ||||||
|  |   if HandleAllocated then | ||||||
|  |     TWSCustomEditClass(WidgetSetClass).SetEchoMode(Self, Val); | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| {------------------------------------------------------------------------------ | {------------------------------------------------------------------------------ | ||||||
|  | |||||||
| @ -858,10 +858,8 @@ begin | |||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| class procedure TWin32WSCustomEdit.SetEchoMode(const ACustomEdit: TCustomEdit; NewMode: TEchoMode); | class procedure TWin32WSCustomEdit.SetEchoMode(const ACustomEdit: TCustomEdit; NewMode: TEchoMode); | ||||||
| const |  | ||||||
|   PassWordChar : array[TEchoMode] of char = (#0, ' ','*'); |  | ||||||
| begin | begin | ||||||
|   ACustomEdit.PasswordChar := PassWordChar[NewMode]; |   // nothing to do, SetPasswordChar will do the work | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| class procedure TWin32WSCustomEdit.SetMaxLength(const ACustomEdit: TCustomEdit; NewLength: integer); | class procedure TWin32WSCustomEdit.SetMaxLength(const ACustomEdit: TCustomEdit; NewLength: integer); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 vincents
						vincents