-
22 Mar 2009 9:59 PM #1
[1.2.3] Can't constrain window with container
[1.2.3] Can't constrain window with container
Hi,
The following code won't constrain a window within a container.
I have seen examples using ExtJS, so either my code is wrong, there's a bug, or GXT can't do this yet.
If there is another way to do this, please guide me in the right direction.
Regards,Code:public void onModuleLoad() { ContentPanel center = new ContentPanel(); center.add(new Html("Center")); center.setSize(400, 400); ContentPanel west = new ContentPanel(); west.add(new Html("West")); west.setSize(100, 400); HorizontalPanel main = new HorizontalPanel(); main.add(west); main.add(center); Window w = new Window(); w.setSize(200, 200); w.setConstrain(true); w.setContainer(center.getElement()); w.show(); }
The Jackal
-
27 Mar 2009 3:20 AM #2
The container is only for maximazing the window. Not for dragging.
-
27 Mar 2009 3:29 AM #3
Hi,
I've see this done in ExtJS - for example in Saki's http://examples.extjs.eu
The panel/window -> Simple Window/Panel auto load example the window is limited to the center panel (see pic).
Can this be done in GXT?
Regards,
Carl.
-
27 Mar 2009 3:30 AM #4
EXTJs is not exactly the same than GXT. I move this into the help forum.
-
27 Mar 2009 3:33 AM #5
I look into adding this for the GXT2.0 release.
-
27 Mar 2009 3:38 AM #6
-
30 Mar 2009 12:49 AM #7
+1
-
31 Mar 2009 1:48 AM #8
I do this already with GXT 1.2.3 with the following code
where container is the Component that you want to use as container.Code:Draggable draggable = getDraggable(); draggable.setContainer(container);
Hope this helps
-
31 Mar 2009 3:16 AM #9
Yes draggable already has this.
-
6 Apr 2009 11:47 PM #10
Well those hints have a mostly working solution - I can constrain the title of the window (it's "draggable") to a container... which effectively means a window is contained in a center panel in every direction but south.
The code I used is
Usage:Code:private class ConstrainedWindow extends Window { private Container constrainContainer = null; public void setConstrainContainer(Container<Component> constrainContainer) { this.constrainContainer = constrainContainer; } @Override protected void afterRender() { super.afterRender(); Draggable d = getDraggable(); d.setContainer(constrainContainer); } };
Code:ConstrainedWindow w = new ConstrainedWindow(); w.setConstrainContainer(myContainer);


Reply With Quote