1

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?

Michael Hutter
  • 1,064
  • 13
  • 33
  • What about disabling/switching-off the other monitors during password entry? Obviously there is no relevant information to be missed. Here is some code (albeit written in C) to achieve this: https://stackoverflow.com/a/32885192/26833 – Uwe Raabe Aug 16 '23 at 08:18
  • What demands do you have on password entry ? For a project (done in Delphi6, but that's not relevant here), I did my own keyboard popup. Then I could control all behavior of buttons entry. Of course if a mouse is used the arrow will be visible. Kind of hard without it I imagine. Did it for touch use only. – MyICQ Aug 16 '23 at 09:09
  • @UweRaabe The computer only sees one monitor. The mirroring is done by hardware. So there is no possibility by software to disable the other monitors. – Michael Hutter Aug 16 '23 at 09:51
  • @MyICQ The machine does not have a mouse, so there is only touch, which means there is actually no mouse cursor to hide. It would be a possibility to write the code of this touch keyboard from scratch. But I would prefer a solution to keep the existing code and write something like a "Helper Routine" to suppress the highlighting of the pressed key. – Michael Hutter Aug 16 '23 at 09:58
  • @MichaelHutter fair point. I did my own custom keyboard then because I needed to have custom input - sometimes showing only numeric keypad, at times having options for "default values" at button press, at times evaluation of allowed input during input (by regexp or list). – MyICQ Aug 16 '23 at 12:55

1 Answers1

1

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.

Uwe Raabe
  • 45,288
  • 3
  • 82
  • 130