PDA

View Full Version : Constrain Window within DIV



bobgateaux
11 Nov 2009, 12:52 PM
Hi,

Is it possible to constrain a Window within a specific DIV on a page?

I guess ideally I want to set the Viewport to sit within the DIV but this doesn't seem to work:

RootPanel.get("myDiv").add(myViewport);

Thanks,
Bob.

Arno.Nyhm
12 Nov 2009, 1:53 AM
did you try this (but it looks like for 1.x)?
http://www.extjs.com/forum/showthread.php?t=68576&highlight=constrain

maybe this gives you an idea. pls post some codesnippets if it works :-)

xalvaro
12 Nov 2009, 2:18 AM
we are using this for our windows :


public class ConstrainedWindow extends Window
{

private Container<Component> constrainContainer = null;

public ConstrainedWindow(Container<Component> constrainContainer)
{
this.constrainContainer = constrainContainer;
}


protected void afterRender()
{
super.afterRender();
// Disable existing draggable adding one for whole window using existing handle
getDraggable().setEnabled(false);
Draggable d = new Draggable(this, getDraggable().getDragHandle());
d.setContainer(constrainContainer);
}
}

It's a quick workaround because the resulting behavior is not exactly the one we want (window can't be dragged + hided outside the div).

The perfect behavior would be the same as this one : http://www.smartclient.com/smartgwt/showcase/#layout_windows_dragging
Maybe an update possible for GXT windows :D

bobgateaux
12 Nov 2009, 8:43 AM
we are using this for our windows :


public class ConstrainedWindow extends Window
{

private Container<Component> constrainContainer = null;

public ConstrainedWindow(Container<Component> constrainContainer)
{
this.constrainContainer = constrainContainer;
}


protected void afterRender()
{
super.afterRender();
// Disable existing draggable adding one for whole window using existing handle
getDraggable().setEnabled(false);
Draggable d = new Draggable(this, getDraggable().getDragHandle());
d.setContainer(constrainContainer);
}
}

It's a quick workaround because the resulting behavior is not exactly the one we want (window can't be dragged + hided outside the div).

The perfect behavior would be the same as this one : http://www.smartclient.com/smartgwt/showcase/#layout_windows_dragging
Maybe an update possible for GXT windows :D

You're a genius xalvaro - that works like a dream for me :)

Thank you very much!!