Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Combobox popup position  RSS feed

Jp Moore
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have a situation where a ComboBox is positioned near the bottom of my window. The box is editable and drills down a set of results that match the text typed by the user. If the user has the window full screen and the popup contains more than a few items it would run off the bottom of the screen but the skin that controls the popup calls setAutoFix(true) so the popup is repositioned to remain entirely on the screen. Unfortunately this means it is positioned over the text field so users can't see what they're typing!

I got around this by overriding ComboBoxListViewSkin as follows:

and setting that class as skin for my ComboBoxes in the css file:

However this results in the popup ALWAYS covering part of the text field, and not properly aligned in any way.

Does anyone know a way around this? So far I think my options are:

1. Limit the visible rows in the popup to about 3 (any more causes repositioning).
2. Major overriding of ComboBoxPopupControl, to take control of positioning the popup myself. However I've done similar things in the past and it's come back to bite me as we're moving from Java 7 to Java 8 and changes in the non-public api mean I had to rewrite stuff.
3. Write my own component from scratch

Thanks for any help

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!