Page 2 of 2

Re: Find text fields

Posted: Tue Aug 21, 2018 7:43 am
by salvadordf
The OSR demos use a TBufferPanel to draw the browser contents, which is a TCustomPanel subclass with a background TBitmap.

TBufferPanel gets the focus but it's not a TEdit. The OSR demos use the TChromium.OnPaint event to draw on the background bitmap from TBufferPanel but all keyboard and mouse events have to be notified to TChromium because TBufferPanel is just a "canvas".

Perhaps I'm missing some touch-screen event that should be notified to TChromium. Please, use all possible touch-screen events in Panel1 (TBufferPanel) with this demo and let me know what events are triggered when you touch the screen over the Panel1 component.

Re: Find text fields

Posted: Tue Aug 21, 2018 7:49 am
by salvadordf
By the way, I simplified the KioskOSRBrowser demo and it's available at GitHub.
It also includes a bug fix in the INPUT element detection function.

Re: Find text fields

Posted: Wed Aug 22, 2018 4:52 am
by Hitman
Thanks Salvador! :)
I am very close to the result already :)
I will grab the new demo and use as start.

With best regards

Re: Find text fields

Posted: Wed Aug 22, 2018 9:32 am
by salvadordf
I found this android app to use the phone screen as a second PC monitor :
https://new.spacedesk.ph/
https://play.google.com/store/apps/deta ... edesk.beta

That app allows you to use the touchscreen in your phone too. :D

I installed it in my Android phone and the driver in Windows 10. I tested the KioskOSRBrowser demo and the virtual keyboard works correctly when I use my finger to touch different HTML elements in the browser.

The keyboard is shown instantly when I touch the search box in google.com and it's also hidden when I touch outside the search box. I tried to make some searches using the virtual keyboard with my finger and it worked too.

Please, test the KioskOSRBrowser demo without modifications in your computer.

Re: Find text fields

Posted: Wed Aug 22, 2018 1:14 pm
by Hitman
Hi Salvador,
my problem is,
i cannot use the Delphi onscreen keyboard because it is bad and it does not serve my needs :(
I am sure i am not alone with this because Delphi onscreen keyboard is simply awful.
I therefore need to use my own keyboard which is currently an executable.

When i try to implement my own keyboard as following,

Code: Select all

{ - <<< - [ browser before contextmenu events... ] - >>> - }
procedure TfrmMain.chromiumMainBeforeContextMenu(Sender: TObject;
  const browser: ICefBrowser; const frame: ICefFrame;
  const params: ICefContextMenuParams; const model: ICefMenuModel);
begin
  { remove the bloody right-click pop-up menu }
  model.Clear;

  model.AddSeparator;

  if processExists('OnScreenKeyboard.exe') then
    model.AddItem(KIOSKBROWSER_CONTEXTMENU_HIDEKEYBOARD,
      'Hide virtual keyboard')
  else
    model.AddItem(KIOSKBROWSER_CONTEXTMENU_SHOWKEYBOARD,
      'Show virtual keyboard');

  model.AddSeparator;
  model.AddItem(KIOSKBROWSER_CONTEXTMENU_EXIT, 'Exit');
end;/code] 

In your demo it is "TouchKeyboard1" 
[code]{ - <<< - [ showing on-screen keyboard... ] - >>> - }
procedure TfrmMain.ShowKeyboardMsg(var aMessage: TMessage);
begin
  ShowOnScreenKeyboard;
end;/code]

[code]{ - <<< - [ hiding on-screen keyboard... ] - >>> - }
procedure TfrmMain.HideKeyboardMsg(var aMessage: TMessage);
begin
  CloseOnScreenKeyboard;
end;/code]

It opens the keyboard but never closes  :(

Re: Find text fields

Posted: Wed Aug 22, 2018 1:46 pm
by salvadordf
Hitman wrote: Wed Aug 22, 2018 1:14 pm Hi Salvador,
my problem is,
i cannot use the Delphi onscreen keyboard because it is bad and it does not serve my needs :(
I am sure i am not alone with this because Delphi onscreen keyboard is simply awful.
I therefore need to use my own keyboard which is currently an executable.
I understand. I only wanted to test the code that detects when to show or hide the keyboard.

If the demo works with TTouchKeyboard, then the problem must be in OnScreenKeyboard.exe or the code that
executes and terminates OnScreenKeyboard.exe.
Hitman wrote: Wed Aug 22, 2018 1:14 pm When i try to implement my own keyboard as following,

Code: Select all

{ - <<< - [ browser before contextmenu events... ] - >>> - }
procedure TfrmMain.chromiumMainBeforeContextMenu(Sender: TObject;
  const browser: ICefBrowser; const frame: ICefFrame;
  const params: ICefContextMenuParams; const model: ICefMenuModel);
begin
  { remove the bloody right-click pop-up menu }
  model.Clear;

  model.AddSeparator;

  if processExists('OnScreenKeyboard.exe') then
    model.AddItem(KIOSKBROWSER_CONTEXTMENU_HIDEKEYBOARD,
      'Hide virtual keyboard')
  else
    model.AddItem(KIOSKBROWSER_CONTEXTMENU_SHOWKEYBOARD,
      'Show virtual keyboard');

  model.AddSeparator;
  model.AddItem(KIOSKBROWSER_CONTEXTMENU_EXIT, 'Exit');
end;


In your demo it is "TouchKeyboard1"

Code: Select all

{ - <<< - [ showing on-screen keyboard... ] - >>> - }
procedure TfrmMain.ShowKeyboardMsg(var aMessage: TMessage);
begin
  ShowOnScreenKeyboard;
end;

Code: Select all

{ - <<< - [ hiding on-screen keyboard... ] - >>> - }
procedure TfrmMain.HideKeyboardMsg(var aMessage: TMessage);
begin
  CloseOnScreenKeyboard;
end;
It opens the keyboard but never closes :(
Please, set breakpoints in these lines :
  • if processExists('OnScreenKeyboard.exe') then
  • CloseOnScreenKeyboard;
Check that processExists detects the process correctly and if CloseOnScreenKeyboard terminates that process correctly.