5

When focus is gained into a TextField, the touch screen keyboard doesn't appear.

I suppose it's because a JavaFx Application isn't Metro compliant?

I find a way to pop up the keyboard:

public class Controller {

   public static void showVirtualKeyboard(
      ObservableValue<? extends Boolean> observable,
      Boolean                            oldState,
      Boolean                            hasFocus )
   {
      if( hasFocus ) {
         try {
            Runtime.getRuntime().exec(
               "cmd /c \"C:\\Program Files\\Common Files\\microsoft " +
               "shared\\ink\\tabtip.exe\"" );
         }
         catch( final Throwable t ) {
            LogHelper.severe( t );
         }
      }
   }
}

In any view:

final class VisualAnalysis extends GridPane implements IView {

   private final TextField tech = new TextField();

   @Override
   public void setController( Controller ctrl   ) {
      ...
      tech.focusedProperty().addListener( Controller::showVirtualKeyboard );
   }

It's a workaround. Have you discover a better way?

Aubin
  • 14,617
  • 9
  • 61
  • 84

1 Answers1

2

This is a cool way to show the Windows native virtual keyboard (which I feel is much better than the JavaFX one).

Have you run the application with with the VM arguments

-Dcom.sun.javafx.isEmbedded=true
-Dcom.sun.javafx.virtualKeyboard=javafx

The last one should also take the parameter 'native' but it also shows the JavaFX keyboard for me. So for explicitly showing the Windows keyboard I'm looking for some help myself :)

terix2k11
  • 342
  • 1
  • 4
  • 15
  • @terix2k11 doesnt work, shows no windows onboard keyboard if touch – M. H. Jul 15 '17 at 06:20
  • @M.H. I'm using the focuslistener as proposed by Aubin, too. The post https://stackoverflow.com/questions/38774139/show-touch-keyboard-tabtip-exe-in-windows-10-anniversary-edition/ helped me aswell. I haven't tried it on wIndows 10 yet. – terix2k11 Jul 19 '17 at 11:44