View Full Version : Combo box drop down layout contrainer behaviour

3 Jul 2012, 10:19 PM
Hi Friends,

Just joined the forum, threads are very helpful, hope to find some answers for my questions.

I have developed a custom combo box component which will have option to select multiple values using check box. I am using a dialog window to hold the checkboxlistview component. The issue is when the component is in the tail end of the horizontal screen, it pops up and there is a gap between the component and the dialog window.

I could find that the solution(in ComboBox.restrict() method) for this to set the components.el().setTop(y) it works in some scenarios, but when the window is scrolled down the Y point value changes and behaves unpredictably(atleast for me).

Can anyone please let me know how to identify the dialog window of the combo box component dropping down/ shooting up based on its position(top/bottom) in the screen?.

Hope my explaination is clear enough. Please let me know if it needs clarification or reframing.


3 Jul 2012, 11:42 PM

May you provide code or screenshoots for better understanding the problem

4 Jul 2012, 12:21 AM
i am basically trying to do this as per method in ComboBox component. pls find the method.

protected void restrict() {

int w = Math.max(getWidth(), 70);
// int fh = footer != null ? footer.getHeight() : 0; setting this to constant 10
int fw = list.el().getFrameWidth("tb") + 10;
int h = listView.getHeight() + fw;
int mH = Math.min(maxHeight, Window.getClientHeight() - 10);
h = Math.min(h, mH);
list.setSize(w, h);
list.el().alignTo(getAlignElement(), listAlign, null);
h -= fw;
int width = w - list.el().getFrameWidth("lr");
listView.setSize(width, h);
// if (pageTb != null) {
// pageTb.setWidth(width);
// }

// the below code is where the issue can be solved. basically, i need to set list.el().setTop(y); based on the decision if the
// layout container holding the values will drop down or shoot up based on its position.
int y = list.el().getY();
int b = y + h + fw;
int vh = XDOM.getViewportSize().height + XDOM.getBodyScrollTop();
if (b > vh) {
y = y - (b - vh) - 5;
list.el().setTop(y); // i have set this value if the value holder container droping up

The standard combo box will not give any space between component and the list holder even when it shoots up, but in the custom one i have build, there is a gap. (2nd pic). As you can see since the component is renderd at the bottom of the screen the dialog comes above the component but with a gap.