JSWindow
Overview
The JSWindow object provides functionality for managing and scripting windows and dialogs in a solution. It supports creating modal and non-modal dialogs, customizing their appearance and behavior, and displaying forms within them. Windows can have properties like opacity, size, location, resizable state, and titles, and they can also maintain their state across sessions using bounds storage. ## Functionality
JSWindow provides constants such as DEFAULT for auto-determined bounds, DIALOG for non-modal windows, and MODAL_DIALOG for modal dialogs. These constants simplify the creation and configuration of different window types.
Properties allow fine control over the window’s characteristics. For example, opacity and transparent control visual appearance, while resizable, undecorated, and storeBounds affect interactivity and persistence. Methods enable developers to show or hide windows, manipulate their size and position dynamically, and manage associated forms.
Windows support advanced features like setting CSS classes for styling, managing design-time properties, and attaching handlers for specific events. These features enhance customization and integration within applications.
Refer to the Creating window documentation for additional details.
Constants Summarized
Value used for x, y, width, height of initial bounds when you want the window to auto-determine bounds when shown for the first time.
Value that can be used for bounds in order to specify that a dialog/window should completely fill the screen.
Properties Summarized
Tells whether or not the bounds of this window should be stored/persisted (default false).
Methods Summarized
void
Sets the dialog CSS class, can not be used to alter it when already showing, this should be set before the dialog is used.
Constants Detailed
DEFAULT
Value used for x, y, width, height of initial bounds when you want the window to auto-determine bounds when shown for the first time.
Type Number
Sample
DIALOG
Window type constant that identifies a non-modal dialog type. Non-modal dialogs will allow the user to interact with parent windows, but are less independent then windows with WINDOW type. Dialogs will stay on top of parent windows and are less accessible through the OS window manager. In web-client dialogs will not open in a separate browser window.
Type Number
Sample
FULL_SCREEN
Value that can be used for bounds in order to specify that a dialog/window should completely fill the screen.
Type Number
Sample
MODAL_DIALOG
Window type constant that identifies a modal dialog type. Modal dialogs will not allow the user to interact with the parent window(s) until closed. Dialogs will stay on top of parent windows and are less accessible through the OS window manager. In web-client dialogs will not open in a separate browser window.
Type Number
Sample
Properties Detailed
closeOnEscape
Type Boolean
controller
Get the current controller from the window/dialog.
Type controller
Sample
opacity
Gets/Sets the opacity property. By default will have value 1 (completely opaque), and can be assigned to values between 0 and 1. If set then window will also be undecorated. This should be set before the dialog/window is shown, otherwise it has no effect.
Type Number the opacity of this window
Sample
resizable
Gets/Sets whether or not this window can be resized by the user (default true).
Type Boolean true if the window is resizable by the user; false otherwise.
Sample
storeBounds
Tells whether or not the bounds of this window should be stored/persisted (default false). If true, the window's bounds will be stored when the window is closed. Stored bounds will be used when the window is shown again instead of initialBounds. For non resizable windows, only location is stored/persisted.
Type Boolean true if the window's bounds are stored/persisted; false otherwise.
Sample
title
Gets/Sets the title text.
Type String
Sample
transparent
Gets/Sets the transparency property.
Type Boolean transparency state of the window
Sample
undecorated
Gets/Sets the undecorated property. If set then this window will not have any decoration and can't be moved/resized or closed. This should be set before dialog/window is shown, otherwise has no effect.
Type Boolean if this window will be undecorated
Sample
Methods Detailed
destroy()
Frees the resources allocated by this window. If window is visible, it will close it first by calling hide() and if that fails because it couldn't be hidden it will return false. The window will no longer be available with application.getWindow('windowName') and will no longer be usable.
The main application window cannot be destroyed.
Returns: Boolean true if the window was successfully destroyed; false otherwise.
Sample
getHeight()
Returns the height.
Returns: Number the height.
Sample
getName()
Returns the window name. It will be null in case of main application frame.
Returns: String the window name.
Sample
getParent()
Returns the parent JSWindow, if available.
Returns: JSWindow the parent JSWindow, if available. If there is no parent JSWindow, it will return null.
Sample
getType()
Returns the window type.
Returns: Number the window type. Can be one of JSWindow.DIALOG, JSWindow.MODAL_DIALOG, JSWindow.WINDOW.
Sample
getWidth()
Returns the width.
Returns: Number the width.
Sample
getX()
Returns the x coordinate.
Returns: Number the x coordinate.
Sample
getY()
Returns the y coordinate.
Returns: Number the y coordinate.
Sample
hide()
Hides the window. It can be shown again using window.show(), controller.show() or controller.showRecords(). The main application window cannot be hidden.
Returns: Boolean Boolean true if the window was successfully closed and false otherwise.
Sample
isVisible()
Returns true if the window is visible, false otherwise.
Returns: Boolean true if the window is visible, false otherwise.
Sample
resetBounds()
Deletes the window's currently stored bounds. It will only affect the next show of the window.
Returns: void
Sample
setCSSClass(cssClassName)
Sets the dialog CSS class, can not be used to alter it when already showing, this should be set before the dialog is used. See sample code for examples of CSS classes for display customizations
Parameters
String cssClassName CSS class name
Returns: void
Sample
setInitialBounds(x, y, width, height)
Sets the initial window bounds. The initial bounds are only used the first time this window is shown (what first show means depends on storeBounds property).
Parameters
Number x the initial x coordinate of the window. Can be JSWindow.DEFAULT, JSWindow.FULL_SCREEN.
Number y the initial y coordinate of the window. Can be JSWindow.DEFAULT, JSWindow.FULL_SCREEN.
Number width the initial width of the window. Can be JSWindow.DEFAULT, JSWindow.FULL_SCREEN.
Number height the initial height of the window. Can be JSWindow.DEFAULT, JSWindow.FULL_SCREEN.
Returns: void
Sample
setLocation(x, y)
Set the window location. If the coordinates are not valid they might be corrected. (for example out of screen locations)
Parameters
Returns: void
Sample
setSize(width, height)
Set the window size.
Parameters
Returns: void
Sample
show(form)
Shows the given form(form name, form object or JSForm) in this window.
Parameters
Object form the form that will be shown inside this window. It can be a form name or a form object (actual form or JSForm).
Returns: void
Sample
toBack()
Shows this window behind other windows, if possible.
Returns: void
Sample
toFront()
Bring this window in front of other windows, if possible.
Returns: void
Sample
Last updated
Was this helpful?