Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8092270

[ComboBox] Pressing any printable key or keys should move the selection to the item matching prefix letters in the beginning of title.

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: fx2.1
    • Fix Version/s: tbd_major
    • Component/s: javafx
    • Labels:

      Description

      This is a feature that is available in ComboBox control on Windows. It would be nice if our implementation of ComboBox will also support this behavior.

        Activity

        Hide
        jgiles Jonathan Giles added a comment -
        Will attempt to look at for 2.1, but may not have time.
        Show
        jgiles Jonathan Giles added a comment - Will attempt to look at for 2.1, but may not have time.
        Hide
        ckeimeljfx Christoph Keimel (Inactive) added a comment -
        We also need this feature. We are migrating from an old ui technology to JavaFX on windows. Since the feature was available before, it also needs to be available after the migration. The ticket only states the ComboBox control, but this feature should also be available for the ChoiceBox. On the ComboBox the feature naturally only makes sense, when the ComboBox is not editable.

        I modified the behavior of both classes to register an event listener monitoring when a letter or digit keys are pressed. If this is the case, the listener will check if there is a “prefixSelectionString” already in place on the control and add the pressed key to this string. The listener will then use this string to search the items of the ChoiceBox or ComboBox and select to first item that matches this prefix (ignoring case). A TimerTask is used to clear the “prefixSelectionString” after a certain time has passed, so the user can start from the beginning if he used an incorrect sequence.

        Jonathan: I will send you the patch by mail and I kindly ask you to consider it.
        Show
        ckeimeljfx Christoph Keimel (Inactive) added a comment - We also need this feature. We are migrating from an old ui technology to JavaFX on windows. Since the feature was available before, it also needs to be available after the migration. The ticket only states the ComboBox control, but this feature should also be available for the ChoiceBox. On the ComboBox the feature naturally only makes sense, when the ComboBox is not editable. I modified the behavior of both classes to register an event listener monitoring when a letter or digit keys are pressed. If this is the case, the listener will check if there is a “prefixSelectionString” already in place on the control and add the pressed key to this string. The listener will then use this string to search the items of the ChoiceBox or ComboBox and select to first item that matches this prefix (ignoring case). A TimerTask is used to clear the “prefixSelectionString” after a certain time has passed, so the user can start from the beginning if he used an incorrect sequence. Jonathan: I will send you the patch by mail and I kindly ask you to consider it.
        Hide
        jgiles Jonathan Giles added a comment -
        Attaching patch from Christoph.
        Show
        jgiles Jonathan Giles added a comment - Attaching patch from Christoph.
        Hide
        jgiles Jonathan Giles added a comment -
        This can be looked at for JavaFX 9, but it is too late for 8u60, however I think for now it would be wise if you work on this as a contribution to a project such as ControlsFX (where it operates externally to the controls). This will allow for testing and feedback.
        Show
        jgiles Jonathan Giles added a comment - This can be looked at for JavaFX 9, but it is too late for 8u60, however I think for now it would be wise if you work on this as a contribution to a project such as ControlsFX (where it operates externally to the controls). This will allow for testing and feedback.

          People

          • Assignee:
            jgiles Jonathan Giles
            Reporter:
            jdinga Jindrich Dinga (Inactive)
          • Votes:
            3 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:
              Imported: