Optional alphaOptional alwaysfalse
Always position the window at the top of the window stack.
Optional aspect0
The aspect ratio of width to height to enforce for the window. If this value is equal to or less than zero,
an aspect ratio will not be enforced.
Optional chromiumControl behavior for Chromium policies
Optional contextSuperseded by contextMenuOptions, which offers a larger feature-set and cleaner syntax.
true
Show the context menu when right-clicking on the window.
Gives access to the devtools for the window.
Optional contextConfigure the context menu when right-clicking on a window.
Optional contextSuperseded by contextMenuOptions, which offers a larger feature-set and cleaner syntax.
Configure the context menu when right-clicking on a window.
Optional cornerDefines and applies rounded corners for a frameless window. NOTE: On macOS corner is not ellipse but circle rounded by the average of height and width.
Optional customA field that the user can use to attach serializable data that will be saved when Platform.getSnapshot is called. If a window in a Platform is trying to update or retrieve its own context, it can use the Platform.setWindowContext and Platform.getWindowContext calls. When omitted, inherits from the parent application. As opposed to customData, this is meant for frequent updates and sharing with other contexts.
This Example shows a window sharing context to all it's views.
By executing the code here in the correct context, the view will have global broadcastContext and addContextListener methods available.
The window will synchronize context between views such that calling broadcastContext in any of the views will invoke any listeners added with addContextListener in all attached views.
const me = fin.Window.getCurrentSync();
me.on('options-changed', async (event) => {
if (event.diff.customContext) {
const myViews = await me.getCurrentViews();
const customContext = event.diff.customContext.newVal;
myViews.forEach(v => {
v.updateOptions({customContext});
});
}
})
const me = fin.View.getCurrentSync();
const broadcastContext = async (customContext) => {
const myWindow = await me.getCurrentWindow()
await myWindow.updateOptions({customContext})
};
const addContextListener = async (listener) => {
await me.on('options-changed', (event) => {
if (event.diff.customContext) {
listener(event.diff.customContext.newVal);
}
});
}
Optional customA field that the user can attach serializable data to be ferried around with the window options. When omitted, inherits from the parent application.
Optional frametrue
Show the window's frame.
Optional hidefalse
Hides the window instead of closing it when the close button is pressed.
Optional hotkeysDefines the hotkeys that will be emitted as a hotkey event on the window.
Within Platform, OpenFin also implements a set of pre-defined actions called
keyboard commands
that can be assigned to a specific hotkey in the platform manifest.
This example shows the example of using the hotkeys option on Windows/Views and the corresponding hotkey event emitted when a specified hotkey is pressed.
const myMagicWindow = await fin.Window.create({
name: 'magicWin',
hotkeys: [
{
keys: 'Ctrl+M',
}
]
});
myMagicWindow.on('hotkey', (hotkeyEvent) => {
console.log(`A hotkey was pressed in the magic window!: ${JSON.stringify(hotkeyEvent)}`);
});
After the following change, the hotkey event will no longer be emitted when Ctrl+M is pressed:
const currentHotkeys = (await myMagicWindow.getOptions()).hotkeys;
const newHotkeys = currentHotkeys.filter(hotkey => hotkey.keys !== 'Ctrl+M');
myMagicWindow.updateOptions({
hotkeys: newHotkeys
});
The hotkeys option is configured per-instance and isn't passed down to the children of Window/View.
Therefore, if you want a Window/View and all of its children to support hotkeys, you must configure the hotkeys option for every created child.
Optional iconA URL for the icon to be shown in the window title bar and the taskbar. When omitted, inherits from the parent application.
Note: Window OS caches taskbar icons, therefore an icon change might only be visible after the cache is removed or the uuid is changed.
Optional includetrue
Include window in snapshots returned by Platform.getSnapshot(). Turning this off may be desirable when dealing with
inherently temporary windows whose state shouldn't be preserved, such as modals, menus, or popups.
Optional interopOptional max-1
The maximum height of a window. Will default to the OS defined value if set to -1.
Optional max-1
The maximum width of a window. Will default to the OS defined value if set to -1.
Optional maximizabletrue
Allows the window to be maximized.
Optional min0
The minimum height of the window.
Optional mintrue
The minimum width of the window.
Optional minimizabletrue
Allows the window to be minimized.
Optional opacity1
A flag that specifies how transparent the window will be.
Changing opacity doesn't work on Windows 7 without Aero so setting this value will have no effect there.
This value is clamped between 0.0 and 1.0.
Optional resizabletrue
A flag to allow the user to resize the window.
Optional resizeDefines a region in pixels that will respond to user mouse interaction for resizing a frameless window.
Optional showfalse
**Platforms Only.** If true, will show background images in the layout when the Views are hidden.
This occurs when the window is resizing or a tab is being dragged within the layout.
Optional showtrue
Shows the window's icon in the taskbar.
Optional taskbarSpecify a taskbar group for the window.
If omitted, defaults to app's uuid (fin.Application.getCurrentSync().identity.uuid).
It's only updatable when enableJumpList is set to false.
Optional throttlingWindow throttling state.
enabled: Both background throttling and scheduler throttling are true. It's fully throttled.scheduler-disabled: The background throttling is true, but scheduler throttling is disabled.disabled: The background throttling is false. The throttling is fully disabled.'enabled'
If throttling option is present, the backgroundThrottling option is completely ignored for windows.
Turns anything of matching RGB value transparent.
Caveats: