PDA

View Full Version : Fun with Windows



jlertle
Nov 22, 2008, 6:27 PM
Want to Hide/Cascade/Tile all open windows?

It took me some searching to find this so I thought I would share. This is mostly Animal's code from his modified desktop.js I just tweaked it a little.


<script type="text/javascript">
var HideAllWin = function() {
Ext.WindowMgr.each(function(w) {
if (w.isVisible()) w.minimize();
});
}


var CascAllWin = function() {
var xTick = Math.max(1, 20);
var yTick = Math.max(1, 20);
var x = xTick;
var y = yTick;
Ext.WindowMgr.each(function(w) {
if (w.isVisible() &amp;&amp; !w.maximized) {
w.setPosition(x, y);
x += xTick;
y += yTick;
}
});
}


var TileAllWin = function() {
var availWidth = Ext.lib.Dom.getViewWidth();
var x = 1;
var y = 1;
var nextY = y;
Ext.WindowMgr.each(function(w) {
if (w.isVisible() &amp;&amp; !w.maximized) {
w.setHeight(300); //remove if you don't want to resize windows
w.setWidth(300); //remove if you don't want to resize windows
var wi = w.el.getWidth();


//Wrap to next row if this Window will go off the end
if ((x > 1) &amp;&amp; (x + wi > availWidth)) {
x = 1;
y = nextY;
}


w.setPosition(x, y);
x += wi + 1;
nextY = Math.max(nextY, y + w.el.getHeight() + 1);
}
});
}

</script>


Hope it helps someone!

pjdu
Oct 03, 2009, 1:57 PM
thanks for sharing!

goga21cn
Jul 01, 2010, 4:45 AM
Very Good.

Thanks!