javacssjavafxcontrolsfx

ControlsFX Position of AutCompletePopup is incorrect


I have an AutoCompletionTextFieldBinding object for one of my TextFields. The position of the AutoCompletePopup is offset from the TextField by a good margin, from other images of the popup I can see this is NOT supposed to be the case. What could possible reasons for this be? The TextField is inside an AnchorPane with a padding of 10 on the bottom. I figured that might be it and have tried removing the padding but the issue persists. Is there a way to override the position of the popup? I have tried getting the AutoCompletePopup and setting the styling on it via:

binding.getTextFieldBinding().getAutoCompletionPopup().setStyle("-fx-padding: 100 0 0 0;");

This was just to see if I could see a difference, the above styling makes no visible difference in the position of the popup. Is it possible to set the position through styling to begin with? I am okay with a "hacky" solution that simply move the popup up by a few pixels.

An image of the popup position can be seen here: Visual problem

EDIT: If any additional information is necessary, let me know.


Solution

  • The pop up should be directly under the text field by default. Maybe a "hacky" solution is to just use the translateYProperty like this:

    styling.css:

    .auto-complete-popup {
        -fx-translate-y: -10; /* Move the pop up 10 pixels higher */
    }