How to prevent closing of AutoCompleteCombobox popupmenu on whitespace key press in JavaFX?AutoComplete ComboBox in JavaFXHow to prevent closing of AutoCompleteCombobox popupmenu on SPACE key press in JavaFXHow do I split a string with any whitespace chars as delimiters?How can you automatically remove trailing whitespace in vimHow to auto-remove trailing whitespace in Eclipse?How do I trim whitespace?How to trim leading and trailing whitespace?How to Turn Off Showing Whitespace Characters in Visual Studio IDEJavaFx close window on pressing esc?JavaFX: Capture “Enter” key pressedFocus Traversable on CustomMenuItem. Content loose focus on mouse hoverHow to prevent closing of AutoCompleteCombobox popupmenu on SPACE key press in JavaFX

Can living where Rare Earth magnetic ore is abundant provide any protection?

Can machine learning learn a function like finding maximum from a list?

Planting Trees in Outer Space

Why would an invisible personal shield be necessary?

What Marvel character has this 'W' symbol?

What is the oxidation state of Mn in HMn(CO)5?

What is the term for completing a route uncleanly?

Should I intervene when a colleague in a different department makes students run laps as part of their grade?

Deploying OR solutions and shipping projects

Russian pronunciation of /etc (a directory)

Derivative is just speed of change?

How to innovate in OR

What would the United Kingdom's "optimal" Brexit deal look like?

Database Cache Memory in Performance Monitor drops down significantly after DBCC CheckDB

Applying for mortgage when living together but only one will be on the mortgage

Correct word for a little toy that always stands up?

May a hotel provide accommodation for fewer people than booked?

How can flights operated by the same company have such different prices when marketed by another?

What does 「ちんちんかいかい」 mean?

Scam? Checks via Email

Can I shorten this filter, that finds disk sizes over 100G?

UX writing: When to use "we"?

Does Hanabi allow empty clues?

Given mean and SD, can we approximate the underlying distribution?



How to prevent closing of AutoCompleteCombobox popupmenu on whitespace key press in JavaFX?


AutoComplete ComboBox in JavaFXHow to prevent closing of AutoCompleteCombobox popupmenu on SPACE key press in JavaFXHow do I split a string with any whitespace chars as delimiters?How can you automatically remove trailing whitespace in vimHow to auto-remove trailing whitespace in Eclipse?How do I trim whitespace?How to trim leading and trailing whitespace?How to Turn Off Showing Whitespace Characters in Visual Studio IDEJavaFx close window on pressing esc?JavaFX: Capture “Enter” key pressedFocus Traversable on CustomMenuItem. Content loose focus on mouse hoverHow to prevent closing of AutoCompleteCombobox popupmenu on SPACE key press in JavaFX






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have created a AutoCompleteCombobox in JavaFX, but issue is that combobox popup closes when user presses SPACE key. I want to continue filtering with space character and prevent popup from closing.



I just want to know how can I override the event handler which handles SPACE key press.



Please help...I've been banging my head against the wall all day on this...



package org.fxapps;

import java.text.Normalizer;
import java.util.regex.Pattern;
import java.util.stream.Stream;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.Event;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Tooltip;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.stage.Window;

/**
*
* Uses a combobox tooltip as the suggestion for auto complete and updates the
* combo box itens accordingly <br />
* It does not work with space, space and escape cause the combobox to hide and
* clean the filter ... Send me a PR if you want it to work with all characters
* -> It should be a custom controller - I KNOW!
*
* @author wsiqueir
*
* @param <T>
*/
public class ComboBoxAutoComplete<T>

private ComboBox<T> cmb;
String filter = "";
private ObservableList<T> originalItems;

public ComboBoxAutoComplete(ComboBox<T> cmb)
this.cmb = cmb;
originalItems = FXCollections.observableArrayList(cmb.getItems());
cmb.setTooltip(new Tooltip());
cmb.setOnKeyPressed(this::handleOnKeyPressed);
cmb.setOnHidden(this::handleOnHiding);


public void handleOnKeyPressed(KeyEvent e)
ObservableList<T> filteredList = FXCollections.observableArrayList();
KeyCode code = e.getCode();

if (code.isLetterKey())
filter += e.getText();

if (code == KeyCode.BACK_SPACE && filter.length() > 0)
filter = filter.substring(0, filter.length() - 1);
cmb.getItems().setAll(originalItems);

if (code == KeyCode.ESCAPE)
filter = "";

if (filter.length() == 0)
filteredList = originalItems;
cmb.getTooltip().hide();
else
Stream<T> itens = cmb.getItems().stream();
String txtUsr = unaccent(filter.toString().toLowerCase());
itens.filter(el -> unaccent(el.toString().toLowerCase()).contains(txtUsr)).forEach(filteredList::add);
cmb.getTooltip().setText(txtUsr);
Window stage = cmb.getScene().getWindow();
double posX = stage.getX() + cmb.getBoundsInParent().getMinX();
double posY = stage.getY() + cmb.getBoundsInParent().getMinY();
cmb.getTooltip().show(stage, posX, posY);
cmb.show();

cmb.getItems().setAll(filteredList);


public void handleOnHiding(Event e)
filter = "";
cmb.getTooltip().hide();
T s = cmb.getSelectionModel().getSelectedItem();
cmb.getItems().setAll(originalItems);
cmb.getSelectionModel().select(s);


private String unaccent(String s)
String temp = Normalizer.normalize(s, Normalizer.Form.NFD);
Pattern pattern = Pattern.compile("\pInCombiningDiacriticalMarks+");
return pattern.matcher(temp).replaceAll("");





And this is the test:



package org.fxapps;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class ComboBoxAutoCompleteTest extends Application

private static final String[] LISTA = "Abacate", "Abacaxi", "Ameixa", "Amora", "Araticum", "Atemoia", "Avocado",
"Banana prata", "Caju", "Cana descascada", "Caqui", "Caqui Fuyu", "Carambola", "Cereja", "Coco verde",
"Figo", "Figo da Índia", "Framboesa", "Goiaba", "Graviola", "Jabuticaba", "Jambo", "Jambo rosa", "Jambolão",
"Kino (Kiwano)", "Kiwi", "Laranja Bahia", "Laranja para suco", "Laranja seleta", "Laranja serra d’água",
"Laranjinha kinkan", "Lichia", "Lima da pérsia", "Limão galego", "Limão Taiti", "Maçã argentina",
"Maçã Fuji", "Maçã gala", "Maçã verde", "Mamão formosa", "Mamão Havaí", "Manga espada", "Manga Haden",
"Manga Palmer", "Manga Tommy", "Manga Ubá", "Mangostim", "Maracujá doce", "Maracujá para suco", "Melancia",
"Melancia sem semente", "Melão", "Melão Net", "Melão Orange", "Melão pele de sapo", "Melão redinha",
"Mexerica carioca", "Mexerica Murcote", "Mexerica Ponkan", "Mirtilo", "Morango", "Nectarina",
"Nêspera ou ameixa amarela", "Noni", "Pera asiática", "Pera portuguesa", "Pêssego", "Physalis", "Pinha",
"Pitaia", "Romã", "Tamarilo", "Tamarindo", "Uva red globe", "Uva rosada", "Uva Rubi", "Uva sem semente",
"Abobora moranga", "Abobrinha italiana", "Abobrinha menina", "Alho", "Alho descascado",
"Batata baroa ou cenoura amarela", "Batata bolinha", "Batata doce", "Batata inglesa", "Batata yacon",
"Berinjela", "Beterraba", "Cebola bolinha", "Cebola comum", "Cebola roxa", "Cenoura", "Cenoura baby",
"Couve flor", "Ervilha", "Fava", "Gengibre", "Inhame", "Jiló", "Massa de alho", "Maxixe", "Milho",
"Pimenta biquinho fresca", "Pimenta de bode fresca", "Pimentão amarelo", "Pimentão verde",
"Pimentão vermelho", "Quiabo", "Repolho", "Repolho roxo", "Tomate cereja", "Tomate salada",
"Tomate sem acidez", "Tomate uva", "Vagem", "Agrião", "Alcachofra", "Alface", "Alface americana",
"Almeirão", "Brócolis", "Broto de alfafa", "Broto de bambu", "Broto de feijão", "Cebolinha", "Coentro",
"Couve", "Espinafre", "Hortelã", "Mostarda", "Rúcula", "Salsa", "Ovos brancos", "Ovos de codorna",
"Ovos vermelhos" ;

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


@Override
public void start(Stage stage) throws Exception
ComboBox<String> cmb = new ComboBox<>();
cmb.setTooltip(new Tooltip());
cmb.getItems().addAll(LISTA);
stage.setScene(new Scene(new StackPane(cmb)));
stage.show();
stage.setTitle("Filtrando um ComboBox");
stage.setWidth(300);
stage.setHeight(300);
new ComboBoxAutoComplete<String>(cmb);





I used the help of code mentioned on https://github.com/jesuino/javafx-combox-autocomplete/blob/master/src/main/java/org/fxapps/ComboBoxAutoComplete.java



I have handled all three events (key press, key release, key typed) on combobox but no solutions. I think it is being caused by key press event on combobox item list view.



Bug is mentioned on https://bugs.openjdk.java.net/browse/JDK-8087549



This is the same question as posed here (but I am unable to ask a question or make a comment on that page):
How to prevent closing of AutoCompleteCombobox popupmenu on SPACE key press in JavaFX



There are a lot of good posts here, too (but I am not smart enough to figure out how to get any of them to work and fix this space bug!)
AutoComplete ComboBox in JavaFX



I tried the answer/code on How to prevent closing of AutoCompleteCombobox popupmenu on SPACE key press in JavaFX, but it either doesn't change the behavior and/or I am too stupid to make it work. This is the code I used (and the ComboBox still closes when I hit space)



public class ComboBoxAutoComplete<T> 

private ComboBox<T> cmb;
String filter = "";
private ObservableList<T> originalItems;

public ComboBoxAutoComplete(ComboBox<T> cmb)
this.cmb = cmb;

ComboBoxListViewSkin<T> comboBoxListViewSkin = new ComboBoxListViewSkin<T>(cmb);
comboBoxListViewSkin.getPopupContent().addEventFilter(KeyEvent.ANY, (event) ->
if( event.getCode() == KeyCode.SPACE )
event.consume();

);
cmb.setSkin(comboBoxListViewSkin);

originalItems = FXCollections.observableArrayList(cmb.getItems());
cmb.setTooltip(new Tooltip());
cmb.setOnKeyPressed(this::handleOnKeyPressed);
cmb.setOnHidden(this::handleOnHiding);




public void handleOnKeyPressed(KeyEvent e)
ObservableList<T> filteredList = FXCollections.observableArrayList();
KeyCode code = e.getCode();

ComboBoxListViewSkin<T> comboBoxListViewSkin = new ComboBoxListViewSkin<T>(cmb);
comboBoxListViewSkin.getPopupContent().addEventFilter(KeyEvent.ANY, (event) ->
if( event.getCode() == KeyCode.SPACE )
event.consume();

);
cmb.setSkin(comboBoxListViewSkin);


if (code.isLetterKey()



public void handleOnHiding(Event e)
ComboBoxListViewSkin<T> comboBoxListViewSkin = new ComboBoxListViewSkin<T>(cmb);
comboBoxListViewSkin.getPopupContent().addEventFilter(KeyEvent.ANY, (event) ->
if( event.getCode() == KeyCode.SPACE )
event.consume();

);
cmb.setSkin(comboBoxListViewSkin);
filter = "";
cmb.getTooltip().hide();
T s = cmb.getSelectionModel().getSelectedItem();
cmb.getItems().setAll(originalItems);
cmb.getSelectionModel().select(s);


private String unaccent(String s)
ComboBoxListViewSkin<T> comboBoxListViewSkin = new ComboBoxListViewSkin<T>(cmb);
comboBoxListViewSkin.getPopupContent().addEventFilter(KeyEvent.ANY, (event) ->
if( event.getCode() == KeyCode.SPACE )
event.consume();

);
cmb.setSkin(comboBoxListViewSkin);
String temp = Normalizer.normalize(s, Normalizer.Form.NFD);
Pattern pattern = Pattern.compile("\pInCombiningDiacriticalMarks+");
return pattern.matcher(temp).replaceAll("");












share|improve this question


























  • Possible duplicate of How to prevent closing of AutoCompleteCombobox popupmenu on SPACE key press in JavaFX

    – kleopatra
    Mar 27 at 10:12











  • the question is answered, so this is a duplicate and will be closed. If you have a problem with the answer, be specific in what you don't understand (though it can't ge much simpler - override the combo's skin and let your combo return your version as default)

    – kleopatra
    Mar 27 at 10:16











  • kleopatra, I saw that answer, but it either doesn't work and/or I am not smart enough to figure out how to use it. This is the code I tried (and when I hit 'space' the ComboBox still closes!):

    – Brock Winfrey
    Mar 27 at 12:07











  • looks like you need to learn a bit more about skins and how/when they are instantiated .. instead of setting them again and again, override createDefaultSkin to return the custom one (with the bug hack)

    – kleopatra
    Mar 27 at 13:43











  • K, so this falls squarely under the column of "I am not smart enough to figure out how to use it" . Thank you.

    – Brock Winfrey
    Mar 27 at 16:04

















0















I have created a AutoCompleteCombobox in JavaFX, but issue is that combobox popup closes when user presses SPACE key. I want to continue filtering with space character and prevent popup from closing.



I just want to know how can I override the event handler which handles SPACE key press.



Please help...I've been banging my head against the wall all day on this...



package org.fxapps;

import java.text.Normalizer;
import java.util.regex.Pattern;
import java.util.stream.Stream;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.Event;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Tooltip;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.stage.Window;

/**
*
* Uses a combobox tooltip as the suggestion for auto complete and updates the
* combo box itens accordingly <br />
* It does not work with space, space and escape cause the combobox to hide and
* clean the filter ... Send me a PR if you want it to work with all characters
* -> It should be a custom controller - I KNOW!
*
* @author wsiqueir
*
* @param <T>
*/
public class ComboBoxAutoComplete<T>

private ComboBox<T> cmb;
String filter = "";
private ObservableList<T> originalItems;

public ComboBoxAutoComplete(ComboBox<T> cmb)
this.cmb = cmb;
originalItems = FXCollections.observableArrayList(cmb.getItems());
cmb.setTooltip(new Tooltip());
cmb.setOnKeyPressed(this::handleOnKeyPressed);
cmb.setOnHidden(this::handleOnHiding);


public void handleOnKeyPressed(KeyEvent e)
ObservableList<T> filteredList = FXCollections.observableArrayList();
KeyCode code = e.getCode();

if (code.isLetterKey())
filter += e.getText();

if (code == KeyCode.BACK_SPACE && filter.length() > 0)
filter = filter.substring(0, filter.length() - 1);
cmb.getItems().setAll(originalItems);

if (code == KeyCode.ESCAPE)
filter = "";

if (filter.length() == 0)
filteredList = originalItems;
cmb.getTooltip().hide();
else
Stream<T> itens = cmb.getItems().stream();
String txtUsr = unaccent(filter.toString().toLowerCase());
itens.filter(el -> unaccent(el.toString().toLowerCase()).contains(txtUsr)).forEach(filteredList::add);
cmb.getTooltip().setText(txtUsr);
Window stage = cmb.getScene().getWindow();
double posX = stage.getX() + cmb.getBoundsInParent().getMinX();
double posY = stage.getY() + cmb.getBoundsInParent().getMinY();
cmb.getTooltip().show(stage, posX, posY);
cmb.show();

cmb.getItems().setAll(filteredList);


public void handleOnHiding(Event e)
filter = "";
cmb.getTooltip().hide();
T s = cmb.getSelectionModel().getSelectedItem();
cmb.getItems().setAll(originalItems);
cmb.getSelectionModel().select(s);


private String unaccent(String s)
String temp = Normalizer.normalize(s, Normalizer.Form.NFD);
Pattern pattern = Pattern.compile("\pInCombiningDiacriticalMarks+");
return pattern.matcher(temp).replaceAll("");





And this is the test:



package org.fxapps;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class ComboBoxAutoCompleteTest extends Application

private static final String[] LISTA = "Abacate", "Abacaxi", "Ameixa", "Amora", "Araticum", "Atemoia", "Avocado",
"Banana prata", "Caju", "Cana descascada", "Caqui", "Caqui Fuyu", "Carambola", "Cereja", "Coco verde",
"Figo", "Figo da Índia", "Framboesa", "Goiaba", "Graviola", "Jabuticaba", "Jambo", "Jambo rosa", "Jambolão",
"Kino (Kiwano)", "Kiwi", "Laranja Bahia", "Laranja para suco", "Laranja seleta", "Laranja serra d’água",
"Laranjinha kinkan", "Lichia", "Lima da pérsia", "Limão galego", "Limão Taiti", "Maçã argentina",
"Maçã Fuji", "Maçã gala", "Maçã verde", "Mamão formosa", "Mamão Havaí", "Manga espada", "Manga Haden",
"Manga Palmer", "Manga Tommy", "Manga Ubá", "Mangostim", "Maracujá doce", "Maracujá para suco", "Melancia",
"Melancia sem semente", "Melão", "Melão Net", "Melão Orange", "Melão pele de sapo", "Melão redinha",
"Mexerica carioca", "Mexerica Murcote", "Mexerica Ponkan", "Mirtilo", "Morango", "Nectarina",
"Nêspera ou ameixa amarela", "Noni", "Pera asiática", "Pera portuguesa", "Pêssego", "Physalis", "Pinha",
"Pitaia", "Romã", "Tamarilo", "Tamarindo", "Uva red globe", "Uva rosada", "Uva Rubi", "Uva sem semente",
"Abobora moranga", "Abobrinha italiana", "Abobrinha menina", "Alho", "Alho descascado",
"Batata baroa ou cenoura amarela", "Batata bolinha", "Batata doce", "Batata inglesa", "Batata yacon",
"Berinjela", "Beterraba", "Cebola bolinha", "Cebola comum", "Cebola roxa", "Cenoura", "Cenoura baby",
"Couve flor", "Ervilha", "Fava", "Gengibre", "Inhame", "Jiló", "Massa de alho", "Maxixe", "Milho",
"Pimenta biquinho fresca", "Pimenta de bode fresca", "Pimentão amarelo", "Pimentão verde",
"Pimentão vermelho", "Quiabo", "Repolho", "Repolho roxo", "Tomate cereja", "Tomate salada",
"Tomate sem acidez", "Tomate uva", "Vagem", "Agrião", "Alcachofra", "Alface", "Alface americana",
"Almeirão", "Brócolis", "Broto de alfafa", "Broto de bambu", "Broto de feijão", "Cebolinha", "Coentro",
"Couve", "Espinafre", "Hortelã", "Mostarda", "Rúcula", "Salsa", "Ovos brancos", "Ovos de codorna",
"Ovos vermelhos" ;

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


@Override
public void start(Stage stage) throws Exception
ComboBox<String> cmb = new ComboBox<>();
cmb.setTooltip(new Tooltip());
cmb.getItems().addAll(LISTA);
stage.setScene(new Scene(new StackPane(cmb)));
stage.show();
stage.setTitle("Filtrando um ComboBox");
stage.setWidth(300);
stage.setHeight(300);
new ComboBoxAutoComplete<String>(cmb);





I used the help of code mentioned on https://github.com/jesuino/javafx-combox-autocomplete/blob/master/src/main/java/org/fxapps/ComboBoxAutoComplete.java



I have handled all three events (key press, key release, key typed) on combobox but no solutions. I think it is being caused by key press event on combobox item list view.



Bug is mentioned on https://bugs.openjdk.java.net/browse/JDK-8087549



This is the same question as posed here (but I am unable to ask a question or make a comment on that page):
How to prevent closing of AutoCompleteCombobox popupmenu on SPACE key press in JavaFX



There are a lot of good posts here, too (but I am not smart enough to figure out how to get any of them to work and fix this space bug!)
AutoComplete ComboBox in JavaFX



I tried the answer/code on How to prevent closing of AutoCompleteCombobox popupmenu on SPACE key press in JavaFX, but it either doesn't change the behavior and/or I am too stupid to make it work. This is the code I used (and the ComboBox still closes when I hit space)



public class ComboBoxAutoComplete<T> 

private ComboBox<T> cmb;
String filter = "";
private ObservableList<T> originalItems;

public ComboBoxAutoComplete(ComboBox<T> cmb)
this.cmb = cmb;

ComboBoxListViewSkin<T> comboBoxListViewSkin = new ComboBoxListViewSkin<T>(cmb);
comboBoxListViewSkin.getPopupContent().addEventFilter(KeyEvent.ANY, (event) ->
if( event.getCode() == KeyCode.SPACE )
event.consume();

);
cmb.setSkin(comboBoxListViewSkin);

originalItems = FXCollections.observableArrayList(cmb.getItems());
cmb.setTooltip(new Tooltip());
cmb.setOnKeyPressed(this::handleOnKeyPressed);
cmb.setOnHidden(this::handleOnHiding);




public void handleOnKeyPressed(KeyEvent e)
ObservableList<T> filteredList = FXCollections.observableArrayList();
KeyCode code = e.getCode();

ComboBoxListViewSkin<T> comboBoxListViewSkin = new ComboBoxListViewSkin<T>(cmb);
comboBoxListViewSkin.getPopupContent().addEventFilter(KeyEvent.ANY, (event) ->
if( event.getCode() == KeyCode.SPACE )
event.consume();

);
cmb.setSkin(comboBoxListViewSkin);


if (code.isLetterKey()



public void handleOnHiding(Event e)
ComboBoxListViewSkin<T> comboBoxListViewSkin = new ComboBoxListViewSkin<T>(cmb);
comboBoxListViewSkin.getPopupContent().addEventFilter(KeyEvent.ANY, (event) ->
if( event.getCode() == KeyCode.SPACE )
event.consume();

);
cmb.setSkin(comboBoxListViewSkin);
filter = "";
cmb.getTooltip().hide();
T s = cmb.getSelectionModel().getSelectedItem();
cmb.getItems().setAll(originalItems);
cmb.getSelectionModel().select(s);


private String unaccent(String s)
ComboBoxListViewSkin<T> comboBoxListViewSkin = new ComboBoxListViewSkin<T>(cmb);
comboBoxListViewSkin.getPopupContent().addEventFilter(KeyEvent.ANY, (event) ->
if( event.getCode() == KeyCode.SPACE )
event.consume();

);
cmb.setSkin(comboBoxListViewSkin);
String temp = Normalizer.normalize(s, Normalizer.Form.NFD);
Pattern pattern = Pattern.compile("\pInCombiningDiacriticalMarks+");
return pattern.matcher(temp).replaceAll("");












share|improve this question


























  • Possible duplicate of How to prevent closing of AutoCompleteCombobox popupmenu on SPACE key press in JavaFX

    – kleopatra
    Mar 27 at 10:12











  • the question is answered, so this is a duplicate and will be closed. If you have a problem with the answer, be specific in what you don't understand (though it can't ge much simpler - override the combo's skin and let your combo return your version as default)

    – kleopatra
    Mar 27 at 10:16











  • kleopatra, I saw that answer, but it either doesn't work and/or I am not smart enough to figure out how to use it. This is the code I tried (and when I hit 'space' the ComboBox still closes!):

    – Brock Winfrey
    Mar 27 at 12:07











  • looks like you need to learn a bit more about skins and how/when they are instantiated .. instead of setting them again and again, override createDefaultSkin to return the custom one (with the bug hack)

    – kleopatra
    Mar 27 at 13:43











  • K, so this falls squarely under the column of "I am not smart enough to figure out how to use it" . Thank you.

    – Brock Winfrey
    Mar 27 at 16:04













0












0








0








I have created a AutoCompleteCombobox in JavaFX, but issue is that combobox popup closes when user presses SPACE key. I want to continue filtering with space character and prevent popup from closing.



I just want to know how can I override the event handler which handles SPACE key press.



Please help...I've been banging my head against the wall all day on this...



package org.fxapps;

import java.text.Normalizer;
import java.util.regex.Pattern;
import java.util.stream.Stream;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.Event;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Tooltip;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.stage.Window;

/**
*
* Uses a combobox tooltip as the suggestion for auto complete and updates the
* combo box itens accordingly <br />
* It does not work with space, space and escape cause the combobox to hide and
* clean the filter ... Send me a PR if you want it to work with all characters
* -> It should be a custom controller - I KNOW!
*
* @author wsiqueir
*
* @param <T>
*/
public class ComboBoxAutoComplete<T>

private ComboBox<T> cmb;
String filter = "";
private ObservableList<T> originalItems;

public ComboBoxAutoComplete(ComboBox<T> cmb)
this.cmb = cmb;
originalItems = FXCollections.observableArrayList(cmb.getItems());
cmb.setTooltip(new Tooltip());
cmb.setOnKeyPressed(this::handleOnKeyPressed);
cmb.setOnHidden(this::handleOnHiding);


public void handleOnKeyPressed(KeyEvent e)
ObservableList<T> filteredList = FXCollections.observableArrayList();
KeyCode code = e.getCode();

if (code.isLetterKey())
filter += e.getText();

if (code == KeyCode.BACK_SPACE && filter.length() > 0)
filter = filter.substring(0, filter.length() - 1);
cmb.getItems().setAll(originalItems);

if (code == KeyCode.ESCAPE)
filter = "";

if (filter.length() == 0)
filteredList = originalItems;
cmb.getTooltip().hide();
else
Stream<T> itens = cmb.getItems().stream();
String txtUsr = unaccent(filter.toString().toLowerCase());
itens.filter(el -> unaccent(el.toString().toLowerCase()).contains(txtUsr)).forEach(filteredList::add);
cmb.getTooltip().setText(txtUsr);
Window stage = cmb.getScene().getWindow();
double posX = stage.getX() + cmb.getBoundsInParent().getMinX();
double posY = stage.getY() + cmb.getBoundsInParent().getMinY();
cmb.getTooltip().show(stage, posX, posY);
cmb.show();

cmb.getItems().setAll(filteredList);


public void handleOnHiding(Event e)
filter = "";
cmb.getTooltip().hide();
T s = cmb.getSelectionModel().getSelectedItem();
cmb.getItems().setAll(originalItems);
cmb.getSelectionModel().select(s);


private String unaccent(String s)
String temp = Normalizer.normalize(s, Normalizer.Form.NFD);
Pattern pattern = Pattern.compile("\pInCombiningDiacriticalMarks+");
return pattern.matcher(temp).replaceAll("");





And this is the test:



package org.fxapps;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class ComboBoxAutoCompleteTest extends Application

private static final String[] LISTA = "Abacate", "Abacaxi", "Ameixa", "Amora", "Araticum", "Atemoia", "Avocado",
"Banana prata", "Caju", "Cana descascada", "Caqui", "Caqui Fuyu", "Carambola", "Cereja", "Coco verde",
"Figo", "Figo da Índia", "Framboesa", "Goiaba", "Graviola", "Jabuticaba", "Jambo", "Jambo rosa", "Jambolão",
"Kino (Kiwano)", "Kiwi", "Laranja Bahia", "Laranja para suco", "Laranja seleta", "Laranja serra d’água",
"Laranjinha kinkan", "Lichia", "Lima da pérsia", "Limão galego", "Limão Taiti", "Maçã argentina",
"Maçã Fuji", "Maçã gala", "Maçã verde", "Mamão formosa", "Mamão Havaí", "Manga espada", "Manga Haden",
"Manga Palmer", "Manga Tommy", "Manga Ubá", "Mangostim", "Maracujá doce", "Maracujá para suco", "Melancia",
"Melancia sem semente", "Melão", "Melão Net", "Melão Orange", "Melão pele de sapo", "Melão redinha",
"Mexerica carioca", "Mexerica Murcote", "Mexerica Ponkan", "Mirtilo", "Morango", "Nectarina",
"Nêspera ou ameixa amarela", "Noni", "Pera asiática", "Pera portuguesa", "Pêssego", "Physalis", "Pinha",
"Pitaia", "Romã", "Tamarilo", "Tamarindo", "Uva red globe", "Uva rosada", "Uva Rubi", "Uva sem semente",
"Abobora moranga", "Abobrinha italiana", "Abobrinha menina", "Alho", "Alho descascado",
"Batata baroa ou cenoura amarela", "Batata bolinha", "Batata doce", "Batata inglesa", "Batata yacon",
"Berinjela", "Beterraba", "Cebola bolinha", "Cebola comum", "Cebola roxa", "Cenoura", "Cenoura baby",
"Couve flor", "Ervilha", "Fava", "Gengibre", "Inhame", "Jiló", "Massa de alho", "Maxixe", "Milho",
"Pimenta biquinho fresca", "Pimenta de bode fresca", "Pimentão amarelo", "Pimentão verde",
"Pimentão vermelho", "Quiabo", "Repolho", "Repolho roxo", "Tomate cereja", "Tomate salada",
"Tomate sem acidez", "Tomate uva", "Vagem", "Agrião", "Alcachofra", "Alface", "Alface americana",
"Almeirão", "Brócolis", "Broto de alfafa", "Broto de bambu", "Broto de feijão", "Cebolinha", "Coentro",
"Couve", "Espinafre", "Hortelã", "Mostarda", "Rúcula", "Salsa", "Ovos brancos", "Ovos de codorna",
"Ovos vermelhos" ;

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


@Override
public void start(Stage stage) throws Exception
ComboBox<String> cmb = new ComboBox<>();
cmb.setTooltip(new Tooltip());
cmb.getItems().addAll(LISTA);
stage.setScene(new Scene(new StackPane(cmb)));
stage.show();
stage.setTitle("Filtrando um ComboBox");
stage.setWidth(300);
stage.setHeight(300);
new ComboBoxAutoComplete<String>(cmb);





I used the help of code mentioned on https://github.com/jesuino/javafx-combox-autocomplete/blob/master/src/main/java/org/fxapps/ComboBoxAutoComplete.java



I have handled all three events (key press, key release, key typed) on combobox but no solutions. I think it is being caused by key press event on combobox item list view.



Bug is mentioned on https://bugs.openjdk.java.net/browse/JDK-8087549



This is the same question as posed here (but I am unable to ask a question or make a comment on that page):
How to prevent closing of AutoCompleteCombobox popupmenu on SPACE key press in JavaFX



There are a lot of good posts here, too (but I am not smart enough to figure out how to get any of them to work and fix this space bug!)
AutoComplete ComboBox in JavaFX



I tried the answer/code on How to prevent closing of AutoCompleteCombobox popupmenu on SPACE key press in JavaFX, but it either doesn't change the behavior and/or I am too stupid to make it work. This is the code I used (and the ComboBox still closes when I hit space)



public class ComboBoxAutoComplete<T> 

private ComboBox<T> cmb;
String filter = "";
private ObservableList<T> originalItems;

public ComboBoxAutoComplete(ComboBox<T> cmb)
this.cmb = cmb;

ComboBoxListViewSkin<T> comboBoxListViewSkin = new ComboBoxListViewSkin<T>(cmb);
comboBoxListViewSkin.getPopupContent().addEventFilter(KeyEvent.ANY, (event) ->
if( event.getCode() == KeyCode.SPACE )
event.consume();

);
cmb.setSkin(comboBoxListViewSkin);

originalItems = FXCollections.observableArrayList(cmb.getItems());
cmb.setTooltip(new Tooltip());
cmb.setOnKeyPressed(this::handleOnKeyPressed);
cmb.setOnHidden(this::handleOnHiding);




public void handleOnKeyPressed(KeyEvent e)
ObservableList<T> filteredList = FXCollections.observableArrayList();
KeyCode code = e.getCode();

ComboBoxListViewSkin<T> comboBoxListViewSkin = new ComboBoxListViewSkin<T>(cmb);
comboBoxListViewSkin.getPopupContent().addEventFilter(KeyEvent.ANY, (event) ->
if( event.getCode() == KeyCode.SPACE )
event.consume();

);
cmb.setSkin(comboBoxListViewSkin);


if (code.isLetterKey()



public void handleOnHiding(Event e)
ComboBoxListViewSkin<T> comboBoxListViewSkin = new ComboBoxListViewSkin<T>(cmb);
comboBoxListViewSkin.getPopupContent().addEventFilter(KeyEvent.ANY, (event) ->
if( event.getCode() == KeyCode.SPACE )
event.consume();

);
cmb.setSkin(comboBoxListViewSkin);
filter = "";
cmb.getTooltip().hide();
T s = cmb.getSelectionModel().getSelectedItem();
cmb.getItems().setAll(originalItems);
cmb.getSelectionModel().select(s);


private String unaccent(String s)
ComboBoxListViewSkin<T> comboBoxListViewSkin = new ComboBoxListViewSkin<T>(cmb);
comboBoxListViewSkin.getPopupContent().addEventFilter(KeyEvent.ANY, (event) ->
if( event.getCode() == KeyCode.SPACE )
event.consume();

);
cmb.setSkin(comboBoxListViewSkin);
String temp = Normalizer.normalize(s, Normalizer.Form.NFD);
Pattern pattern = Pattern.compile("\pInCombiningDiacriticalMarks+");
return pattern.matcher(temp).replaceAll("");












share|improve this question
















I have created a AutoCompleteCombobox in JavaFX, but issue is that combobox popup closes when user presses SPACE key. I want to continue filtering with space character and prevent popup from closing.



I just want to know how can I override the event handler which handles SPACE key press.



Please help...I've been banging my head against the wall all day on this...



package org.fxapps;

import java.text.Normalizer;
import java.util.regex.Pattern;
import java.util.stream.Stream;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.Event;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Tooltip;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.stage.Window;

/**
*
* Uses a combobox tooltip as the suggestion for auto complete and updates the
* combo box itens accordingly <br />
* It does not work with space, space and escape cause the combobox to hide and
* clean the filter ... Send me a PR if you want it to work with all characters
* -> It should be a custom controller - I KNOW!
*
* @author wsiqueir
*
* @param <T>
*/
public class ComboBoxAutoComplete<T>

private ComboBox<T> cmb;
String filter = "";
private ObservableList<T> originalItems;

public ComboBoxAutoComplete(ComboBox<T> cmb)
this.cmb = cmb;
originalItems = FXCollections.observableArrayList(cmb.getItems());
cmb.setTooltip(new Tooltip());
cmb.setOnKeyPressed(this::handleOnKeyPressed);
cmb.setOnHidden(this::handleOnHiding);


public void handleOnKeyPressed(KeyEvent e)
ObservableList<T> filteredList = FXCollections.observableArrayList();
KeyCode code = e.getCode();

if (code.isLetterKey())
filter += e.getText();

if (code == KeyCode.BACK_SPACE && filter.length() > 0)
filter = filter.substring(0, filter.length() - 1);
cmb.getItems().setAll(originalItems);

if (code == KeyCode.ESCAPE)
filter = "";

if (filter.length() == 0)
filteredList = originalItems;
cmb.getTooltip().hide();
else
Stream<T> itens = cmb.getItems().stream();
String txtUsr = unaccent(filter.toString().toLowerCase());
itens.filter(el -> unaccent(el.toString().toLowerCase()).contains(txtUsr)).forEach(filteredList::add);
cmb.getTooltip().setText(txtUsr);
Window stage = cmb.getScene().getWindow();
double posX = stage.getX() + cmb.getBoundsInParent().getMinX();
double posY = stage.getY() + cmb.getBoundsInParent().getMinY();
cmb.getTooltip().show(stage, posX, posY);
cmb.show();

cmb.getItems().setAll(filteredList);


public void handleOnHiding(Event e)
filter = "";
cmb.getTooltip().hide();
T s = cmb.getSelectionModel().getSelectedItem();
cmb.getItems().setAll(originalItems);
cmb.getSelectionModel().select(s);


private String unaccent(String s)
String temp = Normalizer.normalize(s, Normalizer.Form.NFD);
Pattern pattern = Pattern.compile("\pInCombiningDiacriticalMarks+");
return pattern.matcher(temp).replaceAll("");





And this is the test:



package org.fxapps;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class ComboBoxAutoCompleteTest extends Application

private static final String[] LISTA = "Abacate", "Abacaxi", "Ameixa", "Amora", "Araticum", "Atemoia", "Avocado",
"Banana prata", "Caju", "Cana descascada", "Caqui", "Caqui Fuyu", "Carambola", "Cereja", "Coco verde",
"Figo", "Figo da Índia", "Framboesa", "Goiaba", "Graviola", "Jabuticaba", "Jambo", "Jambo rosa", "Jambolão",
"Kino (Kiwano)", "Kiwi", "Laranja Bahia", "Laranja para suco", "Laranja seleta", "Laranja serra d’água",
"Laranjinha kinkan", "Lichia", "Lima da pérsia", "Limão galego", "Limão Taiti", "Maçã argentina",
"Maçã Fuji", "Maçã gala", "Maçã verde", "Mamão formosa", "Mamão Havaí", "Manga espada", "Manga Haden",
"Manga Palmer", "Manga Tommy", "Manga Ubá", "Mangostim", "Maracujá doce", "Maracujá para suco", "Melancia",
"Melancia sem semente", "Melão", "Melão Net", "Melão Orange", "Melão pele de sapo", "Melão redinha",
"Mexerica carioca", "Mexerica Murcote", "Mexerica Ponkan", "Mirtilo", "Morango", "Nectarina",
"Nêspera ou ameixa amarela", "Noni", "Pera asiática", "Pera portuguesa", "Pêssego", "Physalis", "Pinha",
"Pitaia", "Romã", "Tamarilo", "Tamarindo", "Uva red globe", "Uva rosada", "Uva Rubi", "Uva sem semente",
"Abobora moranga", "Abobrinha italiana", "Abobrinha menina", "Alho", "Alho descascado",
"Batata baroa ou cenoura amarela", "Batata bolinha", "Batata doce", "Batata inglesa", "Batata yacon",
"Berinjela", "Beterraba", "Cebola bolinha", "Cebola comum", "Cebola roxa", "Cenoura", "Cenoura baby",
"Couve flor", "Ervilha", "Fava", "Gengibre", "Inhame", "Jiló", "Massa de alho", "Maxixe", "Milho",
"Pimenta biquinho fresca", "Pimenta de bode fresca", "Pimentão amarelo", "Pimentão verde",
"Pimentão vermelho", "Quiabo", "Repolho", "Repolho roxo", "Tomate cereja", "Tomate salada",
"Tomate sem acidez", "Tomate uva", "Vagem", "Agrião", "Alcachofra", "Alface", "Alface americana",
"Almeirão", "Brócolis", "Broto de alfafa", "Broto de bambu", "Broto de feijão", "Cebolinha", "Coentro",
"Couve", "Espinafre", "Hortelã", "Mostarda", "Rúcula", "Salsa", "Ovos brancos", "Ovos de codorna",
"Ovos vermelhos" ;

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


@Override
public void start(Stage stage) throws Exception
ComboBox<String> cmb = new ComboBox<>();
cmb.setTooltip(new Tooltip());
cmb.getItems().addAll(LISTA);
stage.setScene(new Scene(new StackPane(cmb)));
stage.show();
stage.setTitle("Filtrando um ComboBox");
stage.setWidth(300);
stage.setHeight(300);
new ComboBoxAutoComplete<String>(cmb);





I used the help of code mentioned on https://github.com/jesuino/javafx-combox-autocomplete/blob/master/src/main/java/org/fxapps/ComboBoxAutoComplete.java



I have handled all three events (key press, key release, key typed) on combobox but no solutions. I think it is being caused by key press event on combobox item list view.



Bug is mentioned on https://bugs.openjdk.java.net/browse/JDK-8087549



This is the same question as posed here (but I am unable to ask a question or make a comment on that page):
How to prevent closing of AutoCompleteCombobox popupmenu on SPACE key press in JavaFX



There are a lot of good posts here, too (but I am not smart enough to figure out how to get any of them to work and fix this space bug!)
AutoComplete ComboBox in JavaFX



I tried the answer/code on How to prevent closing of AutoCompleteCombobox popupmenu on SPACE key press in JavaFX, but it either doesn't change the behavior and/or I am too stupid to make it work. This is the code I used (and the ComboBox still closes when I hit space)



public class ComboBoxAutoComplete<T> 

private ComboBox<T> cmb;
String filter = "";
private ObservableList<T> originalItems;

public ComboBoxAutoComplete(ComboBox<T> cmb)
this.cmb = cmb;

ComboBoxListViewSkin<T> comboBoxListViewSkin = new ComboBoxListViewSkin<T>(cmb);
comboBoxListViewSkin.getPopupContent().addEventFilter(KeyEvent.ANY, (event) ->
if( event.getCode() == KeyCode.SPACE )
event.consume();

);
cmb.setSkin(comboBoxListViewSkin);

originalItems = FXCollections.observableArrayList(cmb.getItems());
cmb.setTooltip(new Tooltip());
cmb.setOnKeyPressed(this::handleOnKeyPressed);
cmb.setOnHidden(this::handleOnHiding);




public void handleOnKeyPressed(KeyEvent e)
ObservableList<T> filteredList = FXCollections.observableArrayList();
KeyCode code = e.getCode();

ComboBoxListViewSkin<T> comboBoxListViewSkin = new ComboBoxListViewSkin<T>(cmb);
comboBoxListViewSkin.getPopupContent().addEventFilter(KeyEvent.ANY, (event) ->
if( event.getCode() == KeyCode.SPACE )
event.consume();

);
cmb.setSkin(comboBoxListViewSkin);


if (code.isLetterKey()



public void handleOnHiding(Event e)
ComboBoxListViewSkin<T> comboBoxListViewSkin = new ComboBoxListViewSkin<T>(cmb);
comboBoxListViewSkin.getPopupContent().addEventFilter(KeyEvent.ANY, (event) ->
if( event.getCode() == KeyCode.SPACE )
event.consume();

);
cmb.setSkin(comboBoxListViewSkin);
filter = "";
cmb.getTooltip().hide();
T s = cmb.getSelectionModel().getSelectedItem();
cmb.getItems().setAll(originalItems);
cmb.getSelectionModel().select(s);


private String unaccent(String s)
ComboBoxListViewSkin<T> comboBoxListViewSkin = new ComboBoxListViewSkin<T>(cmb);
comboBoxListViewSkin.getPopupContent().addEventFilter(KeyEvent.ANY, (event) ->
if( event.getCode() == KeyCode.SPACE )
event.consume();

);
cmb.setSkin(comboBoxListViewSkin);
String temp = Normalizer.normalize(s, Normalizer.Form.NFD);
Pattern pattern = Pattern.compile("\pInCombiningDiacriticalMarks+");
return pattern.matcher(temp).replaceAll("");









javafx filter combobox whitespace






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 27 at 12:10







Brock Winfrey

















asked Mar 26 at 22:10









Brock WinfreyBrock Winfrey

62 bronze badges




62 bronze badges















  • Possible duplicate of How to prevent closing of AutoCompleteCombobox popupmenu on SPACE key press in JavaFX

    – kleopatra
    Mar 27 at 10:12











  • the question is answered, so this is a duplicate and will be closed. If you have a problem with the answer, be specific in what you don't understand (though it can't ge much simpler - override the combo's skin and let your combo return your version as default)

    – kleopatra
    Mar 27 at 10:16











  • kleopatra, I saw that answer, but it either doesn't work and/or I am not smart enough to figure out how to use it. This is the code I tried (and when I hit 'space' the ComboBox still closes!):

    – Brock Winfrey
    Mar 27 at 12:07











  • looks like you need to learn a bit more about skins and how/when they are instantiated .. instead of setting them again and again, override createDefaultSkin to return the custom one (with the bug hack)

    – kleopatra
    Mar 27 at 13:43











  • K, so this falls squarely under the column of "I am not smart enough to figure out how to use it" . Thank you.

    – Brock Winfrey
    Mar 27 at 16:04

















  • Possible duplicate of How to prevent closing of AutoCompleteCombobox popupmenu on SPACE key press in JavaFX

    – kleopatra
    Mar 27 at 10:12











  • the question is answered, so this is a duplicate and will be closed. If you have a problem with the answer, be specific in what you don't understand (though it can't ge much simpler - override the combo's skin and let your combo return your version as default)

    – kleopatra
    Mar 27 at 10:16











  • kleopatra, I saw that answer, but it either doesn't work and/or I am not smart enough to figure out how to use it. This is the code I tried (and when I hit 'space' the ComboBox still closes!):

    – Brock Winfrey
    Mar 27 at 12:07











  • looks like you need to learn a bit more about skins and how/when they are instantiated .. instead of setting them again and again, override createDefaultSkin to return the custom one (with the bug hack)

    – kleopatra
    Mar 27 at 13:43











  • K, so this falls squarely under the column of "I am not smart enough to figure out how to use it" . Thank you.

    – Brock Winfrey
    Mar 27 at 16:04
















Possible duplicate of How to prevent closing of AutoCompleteCombobox popupmenu on SPACE key press in JavaFX

– kleopatra
Mar 27 at 10:12





Possible duplicate of How to prevent closing of AutoCompleteCombobox popupmenu on SPACE key press in JavaFX

– kleopatra
Mar 27 at 10:12













the question is answered, so this is a duplicate and will be closed. If you have a problem with the answer, be specific in what you don't understand (though it can't ge much simpler - override the combo's skin and let your combo return your version as default)

– kleopatra
Mar 27 at 10:16





the question is answered, so this is a duplicate and will be closed. If you have a problem with the answer, be specific in what you don't understand (though it can't ge much simpler - override the combo's skin and let your combo return your version as default)

– kleopatra
Mar 27 at 10:16













kleopatra, I saw that answer, but it either doesn't work and/or I am not smart enough to figure out how to use it. This is the code I tried (and when I hit 'space' the ComboBox still closes!):

– Brock Winfrey
Mar 27 at 12:07





kleopatra, I saw that answer, but it either doesn't work and/or I am not smart enough to figure out how to use it. This is the code I tried (and when I hit 'space' the ComboBox still closes!):

– Brock Winfrey
Mar 27 at 12:07













looks like you need to learn a bit more about skins and how/when they are instantiated .. instead of setting them again and again, override createDefaultSkin to return the custom one (with the bug hack)

– kleopatra
Mar 27 at 13:43





looks like you need to learn a bit more about skins and how/when they are instantiated .. instead of setting them again and again, override createDefaultSkin to return the custom one (with the bug hack)

– kleopatra
Mar 27 at 13:43













K, so this falls squarely under the column of "I am not smart enough to figure out how to use it" . Thank you.

– Brock Winfrey
Mar 27 at 16:04





K, so this falls squarely under the column of "I am not smart enough to figure out how to use it" . Thank you.

– Brock Winfrey
Mar 27 at 16:04












0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55366919%2fhow-to-prevent-closing-of-autocompletecombobox-popupmenu-on-whitespace-key-press%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55366919%2fhow-to-prevent-closing-of-autocompletecombobox-popupmenu-on-whitespace-key-press%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴