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 an 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.

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

will be 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:

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(force, callbackopt, errorCallbackopt)

Closes the window.

Parameters:
Name Type Attributes Description
force boolean

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 code in the window's page.

Parameters:
Name Type Attributes Description
code string

The JavaScript to execute.

callback function <optional>

called after the script has been executed and passed the result.

errorCallback function <optional>

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

Tutorials:
  • Tutorial: window.executeJavaScript

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:
  • Tutorial: window.getNativeWindow
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:

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

will be 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(callback, errorCallback)

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

Parameters:
Name Type Description
callback function

called if the method succeeds.

errorCallback function

called if the method fails.

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:

show(force, callbackopt, errorCallbackopt)

Shows the window if it is hidden.

Parameters:
Name Type Attributes Description
force boolean

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, force, 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 Description
left int

The left position of the window.

top int

The right position of the window.

force boolean

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.

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.

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:

(inner) buildWindow() → {undefined}

Serves to construct the window object. This is expected to be bound to a context

Returns:

[description]

Type
undefined