Touch-It Virtual Keyboard Version 4.9.2
Windows messages

This topic demonstrates how to drive Touch-It using simple Windows messages.

Show/hide keyboard

Delphi example of how to show or hide the keyboard with the message WM_TOUCHITSHOWHIDE.
  • wParam
    • 0: Hide
    • 1: Show
  • lParam
    • Template identification (ID)
Interface

var

//Variable for unique Windows message ID
WM_TOUCHITSHOWHIDE :integer;


implementation

procedure ShowKeyboard(aShow :boolean; aLayout :integer);
begin

SendMessage(FindWindow(nil, PChar('Touch-It Keyboard')),

WM_TOUCHITSHOWHIDE,
integer(aShow),
aLayout);

end;

//Retreive the unique Windows message ID
initialization

WM_TOUCHITSHOWHIDE := RegisterWindowMessage('WM_TOUCHITSHOWHIDE');

Keyboard position

Delphi example of how to select the keyboard position (appbar, floating, corners, etc.) with the message WM_TOUCHITPOSITION.
  • wParam
    • -1 : Default position defined in the setup.
    • 0 : Left appbar
    • 1 : Top appbar
    • 2 : Right appbar
    • 3 : Bottom appbar
    • 4 : Floating
    • 5 : Reserved
    • 6 : Reserved
    • 7 : Top-left corner
    • 8 : Top-right corner
    • 9 : Bottom-left corner
    • 10 : Bottom-right corner
  • lParam
    • Template identification (ID)
Interface

var

//Variable for unique Windows message ID
WM_TOUCHITPOSITION:integer;


implementation

procedure SelectPositionType(aPos :integer; aLayout :integer);
begin

SendMessage(FindWindow(nil, PChar('Touch-It Keyboard')),

WM_TOUCHITPOSITION,
aPos,
aLayout);

end;

//Retreive the unique Windows message ID
initialization

WM_TOUCHITPOSITION := RegisterWindowMessage('WM_TOUCHITPOSITION');

Floating keyboard position

Delphi example of how to a set keyboard position using either WM_TOUCHITSETPOS or WM_TOUCHITSETBOUNDPOS messages.

1. WM_TOUCHITSETPOS

set absolute keyboard position.
  • wParamHi: X
  • wParamLo: Y
  • lParam
    • 0 : Screen position is not checked
    • 1 : Must lies within work area
Interface

var

//Variable for unique Windows message ID
WM_TOUCHITSETPOS:integer;


implementation

procedure SetPosition(x, y :integer; aWorkArea :boolean);
begin

SendMessage(FindWindow(nil, PChar('Touch-It Keyboard')),

WM_TOUCHITSETPOS,
MakeLong(y, x),
integer(aWorkArea));

end;

//Retreive the unique Windows message ID
initialization

WM_TOUCHITSETPOS := RegisterWindowMessage('WM_TOUCHITSETPOS');

2. WM_TOUCHITSETBOUNDPOS

Set keyboard position above or beneath an edit control without hidding it.
  • wParamHi: Edit control Left
  • wParamLo: Edit control Top
  • wParamLo: Edit control Top
  • wParamHi: Edit control Bottom
Interface

var

//Variable for unique Windows message ID
WM_TOUCHITSETBOUNDPOS:integer;


implementation

//OnEnter edit control event
procedure TForm1.Edit1Enter(Sender: TObject);
begin

//ClientToScreen retreives screen coordinates of the control
with TControl(Sender), ClientToScreen(Point(0, 0)) do

SendMessage(FindWindow(nil, PChar('Touch-It Keyboard')),

WM_TOUCHITSETBOUNDPOS,
MakeLong(y, x),
MakeLong(y +Height, x +Width));

end;

//Retreive the unique Windows message ID
initialization

WM_TOUCHITSETBOUNDPOS := RegisterWindowMessage('WM_TOUCHITSETBOUNDPOS');

Copyright © 2011 Chessware SA