DHTMLX Docs & Samples Explorer

Global Events

Resizing, Moving, Focusing
Source
<link rel="stylesheet" type="text/css" href="../../codebase/dhtmlxwindows.css">
<link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxwindows_dhx_skyblue.css">
<script src="../../codebase/dhtmlxcommon.js"></script>
<script src="../../codebase/dhtmlxwindows.js"></script>
 
<script src="../../codebase/dhtmlxcontainer.js"></script>
 
<div>
<table>
    <tr>
        <td style="padding-right: 10px;">Resizing, Moving, Focusing</td>
    </tr>
    <tr>
        <td>
            <div id="res" style="height: 250px; overflow: auto;"></div>
        </td>
    </tr>
</table>
</div>
<div id="winVP" style="position: relative; height: 500px; border: #cecece 1px solid; margin: 10px;"></div>
<script>
var dhxWins,
w1,
w2,
w3;
function doOnLoad() {
    dhxWins = new dhtmlXWindows();
    dhxWins.enableAutoViewport(false);
    dhxWins.attachViewportTo("winVP");
    dhxWins.setImagePath("../../codebase/imgs/");
    dhxWins.attachEvent("onResizeFinish", doOnResizeFinish);
    dhxWins.attachEvent("onMoveFinish", doOnMoveFinish);
    dhxWins.attachEvent("onFocus", doOnFocus);
    w1 = dhxWins.createWindow("w1", 20, 30, 320, 240);
    w1.setText("dhtmlxWindow #1");
    w1.button("close").disable();
    w2 = dhxWins.createWindow("w2", 50, 70, 320, 240);
    w2.setText("dhtmlxWindow #2");
    w2.button("close").disable();
    w3 = dhxWins.createWindow("w3", 80, 110, 320, 240);
    w3.setText("dhtmlxWindow #3");
    w3.button("close").disable();
}
function doOnResizeFinish(win) {
    document.getElementById("res").innerHTML += win.getText() + " was resized<br>";
}
function doOnMoveFinish(win) {
    document.getElementById("res").innerHTML += win.getText() + " was moved<br>";
}
function doOnFocus(win) {
    document.getElementById("res").innerHTML += win.getText() + " was focused<br>";
}
</script>