Hi
I would like to have a windows that can be dragged around within a canvas. The canvas will have a fixed viewable size, but scroll to a larger fixed size (like a small viewport onto a larger working space). The window object when dragged should cause the canvas to scroll about (up to the limits of the workspace within).
I used a canvas 100% width and height to sit inside the application object, with overflow:auto containing another canvas with a fixed size of 2000X2000. That gives the viewport and workspace environment. Then if i create windows and add them to the outer canvas (so that keepInParentRect works correctly, eg you cannot drag beyond its boundary, instead the box scroll internally). when you drag the window it drags and the canvas scrolls.
First problem. The window would go down to the bottom right hand corner correctly when dragged. Except the border of the window gets hidden under the scollbars (if you go top left you see a little bit extra where it didnt quite go upto the edge). After dragging to bottom right and releasing, if you then try to drag it further down and to the right it causes the canvas to scroll another 10-20 pixels down and right for no reason (red background will be visible). If you drag the window back up and over, the scrollbars shrink back to their original sizes and red border disappears. Try the example file to see this behaviour. This occurs in IE 6 and FF 2.
Next problem. Originally I had planned on using a dragAppearance:“target” on the window with opacity. That was so i could use dragRepositionStop to take action when the window stopped moving (a drop essentially) and get its new position. If you use outline when dragRepositionStop fires the object hasnt actually moved yet so top and left are its original location. In the example, if you uncomment the dragappearance line now. When using FF (which i deved in first) you can no longer drag the window down and to the right and get the scrolling to occur, without the window being left behind. When you release the window has only got as far as the original bottom right corner of viewport. Thats in FF 2, it may work in FF 3 (i’ve not tested myself though). In IE 6 having just tried it, it works better, but when you get right down the viewports space starts growing again and you see the red border.
So i can have something which nearly work but i dont get the rigth position event, or i can have my desired event but not quite scroll about in FF properly. Any help would be greatly appreciated with this.
Tony
<html><head>
<script type="text/javascript">var isomorphicDir="../isomorphic/";</script>
<script src="../isomorphic/system/modules/ISC_Core.js"></script>
<script src="../isomorphic/system/modules/ISC_Foundation.js"></script>
<script src="../isomorphic/system/modules/ISC_Containers.js"></script>
<script src="../isomorphic/system/modules/ISC_Grids.js"></script>
<script src="../isomorphic/system/modules/ISC_Forms.js"></script>
<script src="../isomorphic/system/modules/ISC_DataBinding.js"></script>
<script src="../isomorphic/skins/SmartClient/load_skin.js"></script>
</head><body bgColor="papayawhip" marginHeight="0" marginWidth="0" leftMargin="0" topMargin="0">
<script type="text/javascript">
var authenticationUrl="/login.jsp";
//This limits our workspace size
Canvas.create({
ID:"workspace",
backgroundColor:"yellow",
canDragScoll:true,
width:2000,
height:2000,
autoDraw:false
});
//This is our viewport over the workspace
Canvas.create({
ID:"box",
backgroundColor:"red",
width:"100%",
height:"100%",
overflow:"auto",
children:[workspace]
});
//Main Frame
TabSet.create({
ID:"tabs",
width:"100%",
height:"100%",
tabs:[{title:"tab",pane:box}]
});
//Top level app frame
VLayout.create({
width:"100%",
height:"100%",
members:[Label.create({contents:"navbar",height:30}),tabs]
});
//New window to add
Window.create({
ID:"bla",
width:200,
autoSize:true,
showCloseButton:false,
keepInParentRect:true,
backgroundColor:"black",
// dragAppearance:"target",
dragRepositionStop:'alert("now at "+this.getLeft()+"X"+this.getTop())'
});
//Add a new window to the viewport at specific location
box.addChild(bla);
bla.setTop(100);
bla.setLeft(100);
</script></body></html>