substrate icon indicating copy to clipboard operation
substrate copied to clipboard

non-working input in TextField on Android

Open grigory-dzh-rpj opened this issue 1 year ago • 5 comments

Expected behavior**

An incomprehensible problem with typing in TextField on android 13

Current behavior**

I am programmatically replacing

public VBox newbox() {
VBox v = new VBox()
TextField tf = new TextField();
v.getchildren.setAll(tf);
}
...

vbox.getChildren.setAll(newbox());

And after replacing the TextField, it does not work correctly, the keyboard appears, but any input leaves the input window empty. On iOS, the same code works perfectly!

My environment

Build via ubuntu: -javafx-version 19 -gluon-plugin.version 1.0.23 -charm.version 6.2.3 -gluon-22.1.0.1-Final

https://github.com/user-attachments/assets/5c4fee99-3faf-48da-9297-524f835bdd1d

grigory-dzh-rpj avatar Sep 11 '24 11:09 grigory-dzh-rpj

Maybe you are using custom keyboard, I think, unfortunatly, it only works with default system installed keyboard!

ctoabidmaqbool avatar Sep 11 '24 11:09 ctoabidmaqbool

Maybe you are using custom keyboard, I think, unfortunatly, it only works with default system installed keyboard!

no - I use the standard one and it works until I change the children in the main vbox. But running in the test on linux and iPhone everything works fine everywhere

https://github.com/user-attachments/assets/9f78cee0-995b-4298-ab6c-6a270092edd3

grigory-dzh-rpj avatar Sep 11 '24 11:09 grigory-dzh-rpj

I have the same issue, unfortunately, there is no solution yet.Can you provide minimal reproducibility?

iammmmmmm avatar Sep 12 '24 01:09 iammmmmmm

solution

1)Creating a View controller singleton from FXML let's say fxml contains a view that has only one VBox

<View fx:id="main" stylesheets="@test.css" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.dg.views.MainController" >
      <VBox fx:id="centerViewVbox" alignment="CENTER" BorderPane.alignment="CENTER" >
  private static MainController instance;
    public static MainController getInstance() {
        if (instance == null) {
            instance = new MainController();
        }
        return instance;
    }
    public static void setInstance(MainController mainController) {
        instance = mainController;
    }

**2) I initialize my controller at startup **

 public static MainController startMainController;
@Override
    public void start(Stage primaryStage) throws Exception {
        appManager.start(primaryStage);
        startMainController = MainController.getInstance();
    }

3) Create Vbox c TextFileds

 public VBox vboxWithTextField(){
          VBox vbox = new VBox(new TextField());
          return vbox;
 }

4) Now when I take and change the children from my VBox from startMainController, the input to TextField will no longer work on Android startMainController.centerViewVbox.getChildren.setAll(vboxWithTextField());

grigory-dzh-rpj avatar Sep 12 '24 11:09 grigory-dzh-rpj

Try like this Actively specifying the relationship between multiple "pages" may also solve your problem. The key to this problem may lie in the event loop? I hope it helps you.

iammmmmmm avatar Dec 28 '24 07:12 iammmmmmm