Checkboxes in a combobox popup

Werner Lehmann lehmann at media-interactive.de
Mon Sep 16 05:44:10 PDT 2013


Never mind. I tried to cut some corners reusing a combobox for a 
"checkbox list popup" but this got too complicated. I am using a 
ComboBoxBase extending class now.

Unfortunately it is still quite hard to determine a useful listview size 
for the popup. The original combobox uses package private stuff and hard 
casts on the listview's virtual flow. Obviously I cannot do this.

http://i.imgur.com/5rNDCYT.png

Any idea how I can get rid of the horizontal scrollbar on the listview? 
Is there trick how to size the cells so that they always get the 
available horizontal space - but not more?

Rgds
Werner

On 14.09.2013 00:13, Werner Lehmann wrote:
> Hi,
>
> I am displaying checkboxes in the popup of a combobox via custom cell
> factory. Only problem is that a click on the checkbox actually hides the
> popup, even before that checkbox was selected. As I can see, the
> combobox skin has a MOUSE_PRESSED event filter which hides the popup.
>
> Current workaround is:
> - get the listview from the combobox skin
> - set a MOUSE_PRESSED filter on its parent
> - in the filter detect a click on a checkbox (sets a flag)
> - override combobox.hide, ignore the hide if the flag was set before
>
> The other workaround is to make listview think that the click was on a
> scrollbar by adding "track" to the styleclasses of all checkbox skin
> nodes. Then the listview would ignore the click, too.
>
> Both options seem to be... less optimal. Any other idea?
>
> Rgds
> Werner


More information about the openjfx-dev mailing list