Enter password on a Touch Keyboard without other people seeing it

132 Views Asked by At

I have a kind of security problem.

In Delphi I am using Vcl.Touch.Keyboard.TTouchKeyboard because there is no real keyboard on a machine. There are 4 monitors around this machine which are all displaying the same screen.

There is no problem while typing regular text, but as soon as a user has to type his password on one of the screens, other people can easily see what he is typing and retrieve a password!

enter image description here

The Delphi control TTouchKeyboard obviously does not offer any possibility to hide the mouse cursor as well as to not show the currently clicked button.

How can I disable the OnMouseDown events of TTouchKeyboard without changing the source of this control? Or is there any better solution?
Another possibility would be to optically activate more than one letter per Click to confuse "password watchers". But how can this be done?

1

There are 1 best solutions below

0
Uwe Raabe On BEST ANSWER

TTouchKeyboard allows to override the class used for the buttons. You can derive from TKeyboardButton, override the Paint method skipping the inherited call when the buttons State is dsPressed.

type
  TMyKeyboardButton = class(TKeyboardButton)
  public
    procedure Paint(Canvas: TCustomCanvas = nil); override;
  end;

procedure TMyKeyboardButton.Paint(Canvas: TCustomCanvas);
begin
  if State <> TDrawState.dsPressed then
    inherited;
end;

To make use of this class assign it to the keyboards DefaultButtonClass property.

  TouchKeyboard1.DefaultButtonClass := TMyKeyboardButton;

You might have to switch its Layout property to trigger rebuilding the buttons.