Recent

Author Topic: Virtual keyboard, dissapearing input  (Read 1575 times)

iru

  • Sr. Member
  • ****
  • Posts: 321
Virtual keyboard, dissapearing input
« on: March 13, 2018, 09:16:35 am »
Environment: Linux Mint 18.0, Laz 1.8.0 Samsung Q-412 laptop.

Gentlefolk,
I have an application which requires a small specaised virtual numeric keyboard for use on tablets.

I have written the keyboard as a component based on a tPanel with tSpeedButtons as the numeric buttons.
Currently the keyboard is invoked as a component on the main form of the application.

Code for a key is:
  procedure tNVirt.VKClick(Sender: tObject);
    begin
    // Async call to ensure no collisions with LCL code
    Application.QueueAsyncCall(@SendVK, (Sender as tSpeedButton).Tag);

    procedure tNVirt.SendVK(Data: PtrInt);
      // Emulate a key press
      begin
        KeyInput.Press(Integer(Data));

On my laptop all the above code works when I click on a key (break points).

On a tEdit (in edit mode and accepting characters from the real keyboard) a click on a virtual key results in the edit mode turning off.
Giving focus to a cell on a DBGrid which has code which expects only numeric input crashes in a OnSetField procedure trying to convert a '' (nul/zero length) character.

I have implemented an Application.KeyEvent procedure.

This sees a correct character from the virtual keyboard! I presume this would occur before any 'key' processing.

Somehow things seem to get lost after this....

The tDBGrid has OnKeyPress and OnKeyUp, these do not fire but the OnSetField on the DBGrid colum does which suggests to me that somehow the edit process on the cell is being stopped by something it is receiving.

I have worked my way back through the traces and am lost in Grids, DBGrids, WinControl, ObjPas, etc...

If I get the DBgrid cell into edit mode and enter a key from the physical keyboard everything works.

Any suggestions, brilliant ideas/insights, vast experience.....???

Thanks, Ian

 

TinyPortal © 2005-2018