Module: Window

A basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize, maximize, restore, etc. By default a window does not show upon instantiation; instead the window's show() method must be invoked manually. The new window appears in the same process as the parent window.

Method Index

Synchronous

Asynchronous

Methods

(static) getCurrent() → {fin.desktop.Window}

Returns an instance of the current window.

Tutorials:
Returns:
Type
fin.desktop.Window

(static) wrap(appUuid, windowName) → {fin.desktop.Window}

Returns a Window object that wraps an existing window.

Parameters:
Name Type Description
appUuid string

The UUID of the application to which the window to be wrapped belongs.

windowName string

The name of the window to be wrapped.

Tutorials:
Returns:
Type
fin.desktop.Window

addEventListener(type, listener, callbackopt, errorCallbackopt)

Registers an event listener on the specified event.

Parameters:
Name Type Attributes Description
type string

The type of the event.

listener function

Called whenever an event of the specified type occurs. It is passed an event object containing information related to the event.

callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

animate(transitions, options, callbackopt, errorCallbackopt)

Performs the specified window transitions.

Parameters:
Name Type Attributes Description
transitions object

Describes the animations to preform. See the tutorial.

options object

Options for the animation. See the tutorial.

callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

authenticate(userName, password, callbackopt, errorCallbackopt)

Provides credentials to authentication requests

Parameters:
Name Type Attributes Description
userName string

userName to provide to the authentication challange

password string

password to provide to the authentication challange

callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

blur(callbackopt, errorCallbackopt)

Removes focus from the window.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

bringToFront(callbackopt, errorCallbackopt)

Brings the window to the front of the window stack.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

close(forceopt, callbackopt, errorCallbackopt)

Closes the window.

Parameters:
Name Type Attributes Default Description
force boolean <optional>
false

Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.

callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

disableFrame(callbackopt, errorCallbackopt)

Prevents a user from changing a window's size/position when using the window's frame.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

enableFrame(callbackopt, errorCallbackopt)

Re-enables user changes to a window's size/position when using the window's frame.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

executeJavaScript(code, callbackopt, errorCallbackopt)

Executes Javascript on the window, restricted to windows you own or windows owned by applications you have created.

Parameters:
Name Type Attributes Description
code string

JavaScript code to be executed on the window.

callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

flash(options, callbackopt, errorCallbackopt)

Flashes the window’s frame and taskbar icon until stopFlashing is called.

Parameters:
Name Type Attributes Description
options object

Configuration parameters of the flash.

callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

focus(callbackopt, errorCallbackopt)

Gives focus to the window.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

getBounds(callbackopt, errorCallbackopt)

Gets the current bounds (top, left, width, height) of the window.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

getGroup(callbackopt, errorCallbackopt)

Retrieves an array containing wrapped fin.desktop.Windows that are grouped with this window. If a window is not in a group an empty array is returned. Please note that calling window is included in the result array.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

getNativeWindow() → {window}

Returns the native JavaScript "window" object for the window.

Tutorials:
Returns:
Type
window

getOptions(callbackopt, errorCallbackopt)

Gets the current settings of the window.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

getParentApplication() → {fin.desktop.Application}

Gets the parent application.

Tutorials:
Returns:
Type
fin.desktop.Application

getParentWindow() → {fin.desktop.Window}

Gets the parent window.

Tutorials:
Returns:
Type
fin.desktop.Window

getSnapshot(callbackopt, errorCallbackopt)

Gets a base64 encoded PNG snapshot of the window.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

getState(callbackopt, errorCallbackopt)

Gets the current state ("minimized", "maximized", or "restored") of the window.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

getZoomLevel(callbackopt, errorCallbackopt)

Returns the zoom level of the window.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

hide(callbackopt, errorCallbackopt)

Hides the window.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

isShowing(callbackopt, errorCallbackopt)

Determines if the window is currently showing.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

joinGroup(target, callbackopt, errorCallbackopt)

Joins the same window group as the specified window.

Parameters:
Name Type Attributes Description
target fin.desktop.Window

The window whose group is to be joined.

callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

leaveGroup(callbackopt, errorCallbackopt)

Leaves the current window group so that the window can be move independently of those in the group.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

maximize(callbackopt, errorCallbackopt)

Maximizes the window.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

mergeGroups(target, callbackopt, errorCallbackopt)

Merges the instance's window group with the same window group as the specified window

Parameters:
Name Type Attributes Description
target fin.desktop.Window

The window whose group is to be merged with.

callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

minimize(callbackopt, errorCallbackopt)

Minimizes the window.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

moveBy(deltaLeft, deltaTop, callbackopt, errorCallbackopt)

Moves the window by a specified amount.

Parameters:
Name Type Attributes Description
deltaLeft int

The change in the left position of the window.

deltaTop int

The change in the top position of the window.

callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

moveTo(left, top, callbackopt, errorCallbackopt)

Moves the window to a specified location.

Parameters:
Name Type Attributes Description
left int

The left position of the window.

top int

The top position of the window.

callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

removeEventListener(type, listener, callbackopt, errorCallbackopt)

Removes a previously registered event listener from the specified event.

Parameters:
Name Type Attributes Description
type string

The type of the event

listener function

Called whenever an event of the specified type occurs. It is passed an event object containing information related to the event.

callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

resizeBy(deltaWidth, deltaHeight, anchor, callbackopt, errorCallbackopt)

Resizes the window by a specified amount.

Parameters:
Name Type Attributes Description
deltaWidth int

The change in the width of the window.

deltaHeight int

The change in the height of the window.

anchor string

Specifies a corner to remain fixed during the resize. Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right." If undefined, the default is "top-left".

callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

resizeTo(width, height, anchor, callbackopt, errorCallbackopt)

Resizes the window to the specified dimensions.

Parameters:
Name Type Attributes Description
width int

The change in the width of the window.

height int

The change in the height of the window.

anchor string

Specifies a corner to remain fixed during the resize. Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right." If undefined, the default is "top-left".

callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

restore(callbackopt, errorCallbackopt)

Restores the window to its normal state (i.e., unminimized, unmaximized).

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

setAsForeground(callbackopt, errorCallbackopt)

Will bring the window to the front of the entire stack and give it focus.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

setBounds(left, top, width, height, callbackopt, errorCallbackopt)

Sets the window's size and position.

Parameters:
Name Type Attributes Description
left int

The left position of the window.

top int

The top position of the window.

width int

The width of the window.

height int

The height of the window.

callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

setZoomLevel(level, callbackopt, errorCallbackopt)

Sets the zoom level of the window.

Parameters:
Name Type Attributes Description
level Number

The zoom level.

callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:
  • Tutorial: window.setZoomLevel

show(forceopt, callbackopt, errorCallbackopt)

Shows the window if it is hidden.

Parameters:
Name Type Attributes Default Description
force boolean <optional>
false

Show will be prevented from closing when force is false and ‘show-requested’ has been subscribed to for application’s main window.

callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

showAt(left, top, forceopt, callbackopt, errorCallbackopt)

Shows the window if it is hidden at the specified location. If the toggle parameter is set to true, the window will alternate between showing and hiding.

Parameters:
Name Type Attributes Default Description
left int

The left position of the window.

top int

The right position of the window.

force boolean <optional>
false

Show will be prevented from closing when force is false and ‘show-requested’ has been subscribed to for application’s main window.

callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

stopFlashing(callbackopt, errorCallbackopt)

Stops the taskbar icon from flashing.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

updateOptions(options, callbackopt, errorCallbackopt)

Updates the window using the passed options

Parameters:
Name Type Attributes Description
options object

Changes a window's options that were defined upon creation. See tutorial.

callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials: