Changing the direction of a Combo box dropdown in SWT

Posted by Kris on Stack Overflow See other posts from Stack Overflow or by Kris
Published on 2010-06-15T22:03:23Z Indexed on 2010/06/16 16:02 UTC
Read the original article Hit count: 299

Filed under:
|
|
|

Hi,

I'm building an Eclipse plugin in SWT, and I have the following problem: one of my fields is a combo box, and in some cases it may have fairly long items as selection options. My plugin runs on the right side of the screen, so when you go to use the combo-box, the right side of the combo box is cut off. So, my question is: is there any way to change the dropdown's alignment relative to the combo control? It seems to be permanently left-aligned... and I'm pretty sure you can change the direction in Swing (though the only place I've seen it done is in the Substance UI demo. The Combo Box tab has boxes with North, South East, and West flyout directions... for my application, I need something like the West flyout)

Note: Setting actual text limits is a last-case-scenario option; it would be quite a bit of guesswork to set the text limit dynamically (since the widget's view can be resized).

Here's a picture (sorry, I can only have one link and no images :( ... I need some more rep :p)

Left side of the line: Proper width - the view is the wide enough for the combo dropdown to display all the text; you can see the scrollbars on the right side.

Right side of the line: Too small - Here, the view has been resized, and the combo dropdown scrollbar (as well as some of the text) is cut off by the right side of the screen. I always have more screen space available to the left (since this is always on the right hand side of the screen), but the combo dropdown always appears to the lower right.

Hopefully this is clear enough.

© Stack Overflow or respective owner

Related posts about java

Related posts about usercontrols