Documentation/FbWindow
class

FbWindow

js/foo_uie_jsplitter.js:202

Controls the main foobar2000 application window.

Global state: every JSplitter panel accesses the same native foobar2000 window through fb.Window. Window geometry X, Y, Width, Height, the numeric MinWidth, MinHeight, MaxWidth, MaxHeight are global host state. These numeric values are not automatically restored when a panel reloads or unloads.

Window UI settings such as FrameStyle, Fullscreen, MainMenuHidden, StatusBarHidden, MinSize, MaxSize, and pseudo-caption activation, rectangle, and double-click option defined by SetPseudoCaption are tracked per panel. The most recent explicit assignment made by any live panel becomes the effective global value. When that panel reloads or unloads, its request is removed and the previous request from another live panel, if any, becomes effective again.

If no panel has a request, FrameStyle defaults to FrameStyle.Default, and the boolean settings default to false.

So getters return the effective global value, not the last value assigned by the current panel.

If both minimum and maximum limits are enabled for the same axis, keep the nonzero minimum less than or equal to the nonzero maximum. Contradictory limits are not a supported configuration.

WARNING!
Most methods described here, except for basic window positioning and resizing, are incompatible with plugins that provide similar functionality, such as foo_ui_wizard, foo_openhacks, or foo_ui_hacks. If you intend to use these methods, uninstall such components first. Running them together may cause conflicting behavior and is not a supported configuration.
Legacy geometry API: window.FoobarWindowX, window.FoobarWindowY, window.FoobarWindowWidth, window.FoobarWindowHeight and window.MoveFoobarWindow are deprecated compatibility APIs and will be removed in a future release. New code should use fb.Window geometry properties and Move instead.

Examples

Borderless window with size limits
fb.Window.MinWidth = 500;
fb.Window.MinHeight = 300;
fb.Window.MinSize = true;

fb.Window.MaxWidth = 1600;
fb.Window.MaxHeight = 1000;
fb.Window.MaxSize = true;

fb.Window.FrameStyle = FrameStyle.NoBorder;
Window mode state is shared between panels
// Panel A:
fb.Window.FrameStyle = FrameStyle.NoBorder;

// Panel B, executed later:
fb.Window.FrameStyle = FrameStyle.Default;
// FrameStyle.Default is now effective globally. If Panel B unloads or reloads without this line (e.g. commented),
// Panel A's still-live FrameStyle.NoBorder request becomes effective again.
property

FrameStyle

js/foo_uie_jsplitter.js:288
FrameStyle: FrameStyle = FrameStyle.Default

Controls the native frame style of the main window.

Use FrameStyle:

  • FrameStyle.Default - use the normal foobar2000 window frame.
  • FrameStyle.NoCaption - remove the caption while keeping the native resizable frame. Windows continues to handle resizing, including the thin top resize grip.
  • FrameStyle.NoBorder - remove both the caption and resizable frame. JSplitter restores edge/corner resizing itself.

In No border mode with Default User Interface, a visible native status bar owns its bottom-right size grip. That grip may interfere with resizing from the bottom-right corner; hiding the status bar avoids this limitation.

Throws

Error —

If the value is not a valid FrameStyle value.

property

Fullscreen

js/foo_uie_jsplitter.js:304
Fullscreen: boolean = false

Enables fullscreen mode on the monitor containing the main window. The window covers the full monitor area, including the taskbar.

The previous window placement is restored when fullscreen is disabled, then the current effective FrameStyle is reapplied. Minimum and maximum size limits do not clamp the window while fullscreen is active.

If fullscreen is changed while a modal JSplitter/foobar2000 dialog is open, the native transition is deferred until the modal dialog closes. The property still reports the current effective requested state during that time.

property

Height

js/foo_uie_jsplitter.js:281
Height: number = 0

Height of the outer main-window rectangle, including the non-client frame when present.

propertyreadonly

IsMaximized

js/foo_uie_jsplitter.js:407
IsMaximized: boolean = false

true when the main foobar2000 window is currently maximized.

This property is read-only and reports the actual native window state.

propertyreadonly

IsMinimized

js/foo_uie_jsplitter.js:397
IsMinimized: boolean = false

true when the main foobar2000 window is currently minimized.

This property is read-only and reports the actual native window state.

property

MaxHeight

js/foo_uie_jsplitter.js:378
MaxHeight: number = 0

Maximum height of the outer main-window rectangle when MaxSize is enabled. A value of 0 disables the maximum-height constraint while leaving the maximum-width constraint independent.

property

MaxSize

js/foo_uie_jsplitter.js:361
MaxSize: boolean = false

Enables the maximum main-window size defined by MaxWidth and MaxHeight. Setting this property to true immediately clamps the current window size when needed. Changing an active maximum width or height also clamps the current size immediately. A limit value of 0 means that the corresponding axis is not constrained.

property

MaxWidth

js/foo_uie_jsplitter.js:370
MaxWidth: number = 0

Maximum width of the outer main-window rectangle when MaxSize is enabled. A value of 0 disables the maximum-width constraint while leaving the maximum-height constraint independent.

property

MinHeight

js/foo_uie_jsplitter.js:353
MinHeight: number = 0

Minimum height of the outer main-window rectangle when MinSize is enabled. A value of 0 disables the minimum-height constraint while leaving the minimum-width constraint independent.

property

MinSize

js/foo_uie_jsplitter.js:336
MinSize: boolean = false

Enables the minimum main-window size defined by MinWidth and MinHeight. Setting this property to true immediately clamps the current window size when needed. Changing an active minimum width or height also clamps the current size immediately. A limit value of 0 means that the corresponding axis is not constrained.

property

MinWidth

js/foo_uie_jsplitter.js:345
MinWidth: number = 0

Minimum width of the outer main-window rectangle when MinSize is enabled. A value of 0 disables the minimum-width constraint while leaving the minimum-height constraint independent.

property

StatusBarHidden

js/foo_uie_jsplitter.js:326
StatusBarHidden: boolean = false

Hides the foobar2000 status bar.

Available only with Default User Interface (DUI). Reading or writing this property with Columns UI throws an error.

Throws

Error —

When Columns UI is active.

property

Width

js/foo_uie_jsplitter.js:274
Width: number = 0

Width of the outer main-window rectangle, including the non-client frame when present.

property

X

js/foo_uie_jsplitter.js:260
X: number = 0

X coordinate of the outer main-window rectangle in screen coordinates.

property

Y

js/foo_uie_jsplitter.js:267
Y: number = 0

Y coordinate of the outer main-window rectangle in screen coordinates.

method

ClearPseudoCaption

js/foo_uie_jsplitter.js:498
ClearPseudoCaption()

Disables the current panel's pseudo-caption request previously enabled by SetPseudoCaption. The most recent explicit request now disables the effective global pseudo-caption. Calling SetPseudoCaption enables it again. The request and its stored settings are removed automatically when the panel reloads or unloads. The previous live panel's request, if any, then becomes effective again with its own rectangle and double-click option.

method

Close

js/foo_uie_jsplitter.js:451
Close()

Requests the main foobar2000 window to close using the normal native Windows system command. This follows the same close path as closing the application window normally, rather than terminating the process directly.

The command is posted asynchronously.

method

Maximize

js/foo_uie_jsplitter.js:427
Maximize()

Maximizes the main foobar2000 window using the normal native Windows system command.

The command is posted asynchronously, so IsMaximized may change after the current JavaScript callback returns.

Example

if (!fb.Window.IsMaximized) {
    fb.Window.Maximize();
}
method

Minimize

js/foo_uie_jsplitter.js:417
Minimize()

Minimizes the main foobar2000 window using the normal native Windows system command.

The command is posted asynchronously, so IsMinimized may change after the current JavaScript callback returns.

Example

fb.Window.Minimize();
method

Move

js/foo_uie_jsplitter.js:386
Move(x, y, width, height)

Moves and resizes the main foobar2000 window in one operation. The arguments describe the outer window rectangle in screen coordinates.

Parameters

NameTypeDescription
xnumber

X coordinate in screen coordinates.

ynumber

Y coordinate in screen coordinates.

widthnumber

Outer window width.

heightnumber

Outer window height.

method

MoveStart

js/foo_uie_jsplitter.js:459
MoveStart()

Starts the native Windows move operation for the main foobar2000 window, as if the user had started dragging its caption. This is useful when the script needs to decide dynamically whether a mouse action should start moving the window. For a fixed draggable area, SetPseudoCaption is usually simpler. The move loop is started asynchronously, so the JavaScript callback is not kept running for the duration of the drag.

Example

function on_mouse_lbtn_down(x, y) {
    if (y < 30) {
        fb.Window.MoveStart();
    }
}
method

Restore

js/foo_uie_jsplitter.js:439
Restore()

Restores the main foobar2000 window from a minimized or maximized state to its normal state using the native Windows system command.

The command is posted asynchronously.

Example

if (fb.Window.IsMinimized || fb.Window.IsMaximized) {
    fb.Window.Restore();
}
method

SetPseudoCaption

js/foo_uie_jsplitter.js:473
SetPseudoCaption(x, y, width, height, maximize_on_dblclk)

Defines a rectangular pseudo-caption area for the main foobar2000 window. Pressing the left mouse button inside this area starts the native Windows move operation, including when the pointer is over a child window such as a JSplitter panel. This provides a persistent alternative to calling MoveStart from a mouse callback and is especially useful with FrameStyle set to FrameStyle.NoCaption or FrameStyle.NoBorder.

The coordinates are pixel offsets from the top-left corner of the outer main-window rectangle. The rectangle, activation request, and maximize_on_dblclk option belong to the current panel. The most recent explicit request made by any live panel becomes effective globally. Calling this method again replaces that panel's rectangle and option and enables its request. When the panel reloads or unloads, its request and settings are removed; the previous live panel's request becomes effective again with its own rectangle and option.

With maximize_on_dblclk set to true, a left-button double-click inside the area automatically maximizes a normal window or restores a maximized window, using the same native commands as Maximize and Restore. The handled double-click is consumed and is not delivered to the underlying panel's on_mouse_lbtn_dblclk callback. The default is false, which preserves script-defined double-click handling.

With FrameStyle.NoBorder, resize edges take precedence over both dragging and automatic double-click handling. Dragging is inactive while the main window is fullscreen or maximized. Automatic maximize/restore is inactive in fullscreen mode. A left click used to start dragging is consumed, so interactive controls should not be placed inside the rectangle.

To disable the current panel's request, use ClearPseudoCaption.

Parameters

NameTypeDescription
xnumber

Horizontal offset from the left edge of the outer main-window rectangle.

ynumber

Vertical offset from the top edge of the outer main-window rectangle.

widthnumber

Width of the pseudo-caption rectangle. Must be greater than 0.

heightnumber

Height of the pseudo-caption rectangle. Must be greater than 0.

maximize_on_dblclk = falseoptionalboolean

Enable automatic maximize/restore on a left-button double-click inside the area.

Throws

Error —

If width or height is not greater than 0.

Example

fb.Window.FrameStyle = FrameStyle.NoBorder;
fb.Window.SetPseudoCaption(8, 8, 400, 32, true);