ComboBox keypress discrepancy

Abhinay Agarwal abhinay_agarwal at live.com
Sun Mar 8 08:21:35 UTC 2020


Hi Dirk,

Exactly. The TAB key press event not firing at all seems fishy.

-- Abhinay

________________________________
From: Dirk Lemmermann <dlemmermann at gmail.com>
Sent: Friday, March 6, 2020 2:55 PM
To: Abhinay Agarwal <abhinay_agarwal at live.com>
Cc: openjfx-dev at openjdk.java.net <openjfx-dev at openjdk.java.net>
Subject: Re: ComboBox keypress discrepancy

Regarding expected behaviour: in native combo boxes / dropdowns on Mac the TAB key is doing nothing when the popup is open. If you want to select an item you need to use the arrow keys. So I guess that is what I would expect for navigating the element. But that does not mean that the key event can’t fire, right? Some subclass / custom control might have a need for it.

Dirk



Am 06.03.2020 um 05:59 schrieb Abhinay Agarwal <abhinay_agarwal at live.com<mailto:abhinay_agarwal at live.com>>:

Hi Dirk,

Thanks for reaching out. As stated earlier, I want to know what exactly is causing this change in behaviour. I also want to know what is the expected behaviour in this case: should TAB key press trigger when the popupwindow is showing?

-- Abhinay
________________________________
From: Dirk Lemmermann <dlemmermann at gmail.com<mailto:dlemmermann at gmail.com>>
Sent: Thursday, March 5, 2020 6:39 PM
To: Abhinay Agarwal <abhinay_agarwal at live.com<mailto:abhinay_agarwal at live.com>>
Cc: openjfx-dev at openjdk.java.net<mailto:openjfx-dev at openjdk.java.net> <openjfx-dev at openjdk.java.net<mailto:openjfx-dev at openjdk.java.net>>
Subject: Re: ComboBox keypress discrepancy

So what info do you need? What test do you want us to run?

I ran it on MacOS X with Java 14ea and I DO NOT see the „TAB“ output.

Dirk

Am 05.03.2020 um 11:43 schrieb Abhinay Agarwal <abhinay_agarwal at live.com<mailto:abhinay_agarwal at live.com>>:

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ComboBox;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;

public class Main extends Application {

   @Override
   public void start(Stage primaryStage) {
       final ComboBox<String> stringComboBox = new ComboBox<>();
       stringComboBox.getItems().addAll("John", "Jacob", "Schmidt");
       stringComboBox.addEventHandler(KeyEvent.KEY_PRESSED, kp -> System.out.println(kp.getCode()));

       final Scene scene = new Scene(new BorderPane(stringComboBox), 300, 275);
       primaryStage.setScene(scene);
       primaryStage.show();
   }

   public static void main(String[] args) {
       launch(args);
   }
}



More information about the openjfx-dev mailing list