View Full Version : Basic Dialog - keep inside center layout
benny00
5 Apr 2007, 4:27 AM
Hi all!
Could someone tell me, how to keep a basic dialog from being able to be dragged out of the center panel for example?
constraintoviewport: true only keep the dialog inside the layout. But I have tabs in the center panel and if the dialog is dragged too far, I cant close it.
Animal
5 Apr 2007, 4:41 AM
Try creating the dialog using the container config option.
eg
container: myLayout.getRegion("center").getEl()
The constrain code does use the container as the constraint area. There's a bug in that code though because it only measures the constrained area once, and caches the result.
So if the area changes size (which it might in a Layout), constraining will continue using the old boundaries.
But if you start using this, and hit this problem, report it as a bug...
tolstoj
14 May 2007, 9:09 PM
Hi :)
I am also having a problem with my dialog moving beneath the Tabs in my center panel when I resize the window.
Do I have to make another panel of some sort like I do with the grid (...new Ext.GridPanel(grid, {title: 'Grid', fitToFrame:true...) ?
Cheers
Thomas
stamm
10 Jul 2007, 7:35 AM
Hello!
Unfortunately, there ist still no solution to find in this forum.
How can I prevent a draggable Dialog to be dragged out an specific (html-)element?
In this small example, what is needed to make it work?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>This Dialog shall not be able to be dragged outside the white area</title>
<script type="text/javascript" src="lib/ext/adapter/yui/yui-utilities.js"></script>
<script type="text/javascript" src="lib/ext/adapter/yui/ext-yui-adapter.js"></script>
<script type="text/javascript" src="lib/ext/ext-all.js"></script>
<script type="text/javascript">
Example = new Object();
Example.init = function () {
var dlg = new Ext.BasicDialog('div-dlg', {
title: 'Test Dialog',
height: 200,
width: 300,
minHeight: 100,
minWidth: 150,
modal: false,
proxyDrag: true,
shadow: true
});
dlg.constraintoviewport = true;
dlg.container = Ext.get('div-cont');
dlg.show();
} // end Example.init()
Ext.onReady(Example.init, Example, true);
</script>
<link rel="stylesheet" type="text/css" href="lib/ext/resources/css/ext-all.css" />
<style type="text/css">
#div-cont {
width:600px;
height:400px;
background-color: white;
border: 1px solid #999;
position: absolute;
top:25px;
left:25px;
}
</style>
</head>
<body style="background-color:#eee">
<div id="div-cont"></div>
<div id="div-dlg"></div>
</body>
</html>
Thanks in advance!
Greetz,
stamm
tryanDLS
10 Jul 2007, 8:58 AM
You might try putting these 2 lines into the config in the ctor, rather than after. Depending on the rendering flow, they might not be taken into account after that.
constraintoviewport: true,
container: Ext.get('div-cont'),
stamm
11 Jul 2007, 6:21 AM
Hrm...
unfortunately this doesn
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.