The user can access a window in two following ways:
var myWins = new dhtmlxWindows();
var win = myWins.createWindow(id,...);
var myWins = new dhtmlxWindows();
myWins.window(id);
Thus, the user can access this window using win variable or by calling window() function.
Regardless of the way the window is accessed, the content of "win" variable and "windows.window(id)" will be equal.
If the user wants to change window's dimension, he should use the method setDimension() and pass width and height values:
myWins.window(id).setDimension(int width, int height);
To set only window's width, or only its height, the user should apply the following variants of syntax:
myWins.window(id).setDimension(int width); // only width is set
myWins.window(id).setDimension(null, int height); // only height is set
The same syntax variants are available for methods that are responsible for setting minimum and maximum dimensions. Default minimum and maximum Dimensions are set in dhtmlxWindows. The user has the possibility to set his own minimum and maximum Dimension parameters to a window by calling the methods setMaxDimension() and setMinDimension():
myWins.window(id).setMaxDimension(int maxWidth, int maxHeight);
myWins.window(id).setMinDimension(int minWidth, int minHeight);
There is also a method to get window's dimension (will return array (width, height)):
var dimension = dhxWins.window(id).getDimension();
The following methods can also be used to get minimum and maximum Dimensions:
var maxDimension = myWins.window(id).getMaxDimension();
var minDimension = myWins.window(id).getMinDimension();
Note: a window will be able to occupy the whole viewport after minimizing if the user sets maxDimension to auto:
myWins.window(id).setMaxDimension("auto", "auto");
In this case the window becomes unresizable (only in the maximized state). Note: if the user changes window's dimension in such a way that it can not display the whole title text, the text will be cut.
As with window's dimension, the user is allowed to change window's position. In order to do this, the method setPosition() should be called with values x and y:
myWins.window(id).setPosition(int x, int y);
There is also a command to get window's position (will return Array(x, y)):
var position = myWins.window(id).getPosition();
If the user wants to park a window, he should use the command park(). If the window was parked up, this command makes it park down, and vice versa:
myWins.window(id).park();
To minimize/maximize a window from script, the user should call the following methods:
myWins.window(id).maximize();
myWins.window(id).minimize();
The user can bring any window to the top with the help of the method bringToTop():
myWins.window(id).bringToTop();
In this case the window will be automatically focused.
The method bringToBottom() brings any window to bottom:
myWins.window(id).bringToBottom();
In the situation when this method was applied to the top window, the window that lies right after the top one, occupies its position and becomes the top window. Some peculiarities of these two methods are revealed dealing with sticked/unsticked windows.
The user has the opportunity to stick/unstick a window - to place it always on the top. To do this the user should use methods stick() or unstick().
myWins.window(id).stick();
myWins.window(id).unstick();
If there is any window that was made sticked in the system, global windows behavior will be the following:
There is the possibility to make a window modal calling the method setModal():
myWins.window(id).setModal(Boolean state);
Any modal window has the following features:
The value "true" in the method setModal() makes a window modal, while value "false" makes it modeless. Calling the methods hide() and show() doesn't change the window modality at all. That's why, if you want to hide/show a modal window you should use the related method in pair with setModal().
//to hide a modal window and enable other elements
myWins.window(id).hide();
myWins.window(id).setModal(false);
//to show the modal window again and disable other elements
myWins.window(id).show();
myWins.window(id).setModal(true);
A modal window blocks all other work-flow until it is closed. Thus, the user won't be able to do anything else while a modal window is open. Modal windows can be used in order to warn the user, or draw his attention to some important change, alert, or event that is going to happen.
The user is able to get the handler of the topmost window with the help of the following method:
myWins.window(id).getTopmostWindow();
To get handler of the bottommost window, the user should call the following method:
myWins.window(id).getBottommostWindow();
There is also the possibility to make any window centered (place it in the center of the viewport) by calling the method center(). This method is similar to setPosition() method in some way, but the position of a window is set automatically and does not require the user to specify it.
Note: Position of a window will be defined relative to the viewport.
myWins.window(id).center();
There is also a method which allows you to center window on the screen:
myWins.window(id).centerOnScreen();
The user can show a progress indicator in any window. This indicator will visually inform the user about the fact that the information in a window is still loading. A progress indicator can be shown in the following way:
myWins.window(id).progressOn();
A progress indicator can be easily hidden in a window in such a way:
myWins.window(id).progressOff();
A header of a certain window can be easily hidden by the following method:
myWins.window(id).hideHeader();
The window header will be made visible again in the following way:
myWins.window(id).showHeader();
Use the configuration below to make all the windows inactive:
var myWins = new dhtmlXWindows();
myWins.createWindow("w1",...);
myWins.createWindow("w2",...);
...
myWins._makeActive(null);
Back to top