0

I have in the text box that by choosing the combo box Binds respectively the text field with the specified data. The point is that after the first binding process, you can not remove the effect. I choose binding logins, this Binds me a text box with logins. Then I want Bind the e-mail, then I develop two lists, login and e-mail.

@FXML
public void setToSearch() {
    if(comboSettingsSearch.getSelectionModel().getSelectedIndex() == 1)
        TextFields.bindAutoCompletion(textSearchPerson, Database.loadLogins());
    if(comboSettingsSearch.getSelectionModel().getSelectedIndex() == 5)
        TextFields.bindAutoCompletion(textSearchPerson, Database.loadEmails());

}

enter image description here

Underneath logins, and on top of e-mail. Anyone know how to remove this effect?

Q. One
  • 1
  • 2

3 Answers3

2

If you do it like this,

@FXML
public void setToSearch() {
    if(comboSettingsSearch.getSelectionModel().getSelectedIndex() == 1)
        AutoCompletionBinding<String> acbLogin = TextFields.bindAutoCompletion(textSearchPerson, Database.loadLogins());
    if(comboSettingsSearch.getSelectionModel().getSelectedIndex() == 5)
        AutoCompletionBinding<String> acbEmail = TextFields.bindAutoCompletion(textSearchPerson, Database.loadEmails());
}

you can dispose the binding with

acbLogin.dispose();
acbEmail.dispose();

as far as I can tell from the HelloAutoComplete-example and the javadocs.

Nash
  • 452
  • 1
  • 4
  • 16
0

This is a late response to this post, however, I see that it apparently didn't work because it is not checked. It also didn't work for me but two weeks later I discovered why.

The proposed declaration and initialization above does not work if you include the type as part of the declaration. You need to remove the type from the declaration and then the .dispose() method will work.

This doesn't work:

AutoCompletionBinding<String> acbLogin = TextFields.bindAutoCompletion(textSearchPerson, Database.loadLogins());

This does:

AutoCompletionBinding acbLogin = TextFields.bindAutoCompletion(textSearchPerson, Database.loadLogins());
svstackoverflow
  • 665
  • 6
  • 19
0
AutoCompletionBinding acb = TextFields.bindAutoCompletion(txtfield,arraylistobj);
acb=null;
Tobias Geiselmann
  • 2,139
  • 2
  • 23
  • 36
  • 1
    good that you try to be helpful :) Just wondering if you did try that, are you certain it'll work? Would be astonished .. – kleopatra Feb 13 '20 at 11:20