2022-12-29 16:00:10 +11:00
---
sidebar_position: 4
---
# Window
These methods give control of the application window.
### WindowSetTitle
Sets the text in the window title bar.
2024-02-08 21:28:28 +11:00
Go: `WindowSetTitle(ctx context.Context, title string)`<br/> JS: `WindowSetTitle(title: string)`
2022-12-29 16:00:10 +11:00
### WindowFullscreen
Makes the window full screen.
2024-02-08 21:28:28 +11:00
Go: `WindowFullscreen(ctx context.Context)`<br/> JS: `WindowFullscreen()`
2022-12-29 16:00:10 +11:00
### WindowUnfullscreen
Restores the previous window dimensions and position prior to full screen.
2024-02-08 21:28:28 +11:00
Go: `WindowUnfullscreen(ctx context.Context)`<br/> JS: `WindowUnfullscreen()`
2022-12-29 16:00:10 +11:00
### WindowIsFullscreen
Returns true if the window is full screen.
2024-02-08 21:28:28 +11:00
Go: `WindowIsFullscreen(ctx context.Context) bool`<br/> JS: `WindowIsFullscreen() bool`
2022-12-29 16:00:10 +11:00
### WindowCenter
Centers the window on the monitor the window is currently on.
2024-02-08 21:28:28 +11:00
Go: `WindowCenter(ctx context.Context)`<br/> JS: `WindowCenter()`
2022-12-29 16:00:10 +11:00
### WindowExecJS
Executes arbitrary JS code in the window.
2024-02-08 21:28:28 +11:00
This method runs the code in the browser asynchronously and returns immediately. If the script causes any errors, they will only be available in the browser console.
2022-12-29 16:00:10 +11:00
Go: `WindowExecJS(ctx context.Context, js string)`
### WindowReload
Performs a "reload" (Reloads current page).
2024-02-08 21:28:28 +11:00
Go: `WindowReload(ctx context.Context)`<br/> JS: `WindowReload()`
2022-12-29 16:00:10 +11:00
### WindowReloadApp
Reloads the application frontend.
2024-02-08 21:28:28 +11:00
Go: `WindowReloadApp(ctx context.Context)`<br/> JS: `WindowReloadApp()`
2022-12-29 16:00:10 +11:00
### WindowSetSystemDefaultTheme
Windows only.
2024-02-08 21:28:28 +11:00
Go: `WindowSetSystemDefaultTheme(ctx context.Context)`<br/> JS: `WindowSetSystemDefaultTheme()`
2022-12-29 16:00:10 +11:00
Sets window theme to system default (dark/light).
### WindowSetLightTheme
Windows only.
2024-02-08 21:28:28 +11:00
Go: `WindowSetLightTheme(ctx context.Context)`<br/> JS: `WindowSetLightTheme()`
2022-12-29 16:00:10 +11:00
Sets window theme to light.
### WindowSetDarkTheme
Windows only.
2024-02-08 21:28:28 +11:00
Go: `WindowSetDarkTheme(ctx context.Context)`<br/> JS: `WindowSetDarkTheme()`
2022-12-29 16:00:10 +11:00
Sets window theme to dark.
### WindowShow
Shows the window, if it is currently hidden.
2024-02-08 21:28:28 +11:00
Go: `WindowShow(ctx context.Context)`<br/> JS: `WindowShow()`
2022-12-29 16:00:10 +11:00
### WindowHide
Hides the window, if it is currently visible.
2024-02-08 21:28:28 +11:00
Go: `WindowHide(ctx context.Context)`<br/> JS: `WindowHide()`
2022-12-29 16:00:10 +11:00
### WindowIsNormal
Returns true if the window not minimised, maximised or fullscreen.
2024-02-08 21:28:28 +11:00
Go: `WindowIsNormal(ctx context.Context) bool`<br/> JS: `WindowIsNormal() bool`
2022-12-29 16:00:10 +11:00
### WindowSetSize
Sets the width and height of the window.
2024-02-08 21:28:28 +11:00
Go: `WindowSetSize(ctx context.Context, width int, height int)`<br/> JS: `WindowSetSize(width: number, height: number)`
2022-12-29 16:00:10 +11:00
### WindowGetSize
Gets the width and height of the window.
2024-02-08 21:28:28 +11:00
Go: `WindowGetSize(ctx context.Context) (width int, height int)`<br/> JS: `WindowGetSize() : Size`
2022-12-29 16:00:10 +11:00
### WindowSetMinSize
2024-02-08 21:28:28 +11:00
Sets the minimum window size. Will resize the window if the window is currently smaller than the given dimensions.
2022-12-29 16:00:10 +11:00
Setting a size of `0,0` will disable this constraint.
2024-02-08 21:28:28 +11:00
Go: `WindowSetMinSize(ctx context.Context, width int, height int)`<br/> JS: `WindowSetMinSize(width: number, height: number)`
2022-12-29 16:00:10 +11:00
### WindowSetMaxSize
2024-02-08 21:28:28 +11:00
Sets the maximum window size. Will resize the window if the window is currently larger than the given dimensions.
2022-12-29 16:00:10 +11:00
Setting a size of `0,0` will disable this constraint.
2024-02-08 21:28:28 +11:00
Go: `WindowSetMaxSize(ctx context.Context, width int, height int)`<br/> JS: `WindowSetMaxSize(width: number, height: number)`
2022-12-29 16:00:10 +11:00
### WindowSetAlwaysOnTop
Sets the window AlwaysOnTop or not on top.
2024-02-08 21:28:28 +11:00
Go: `WindowSetAlwaysOnTop(ctx context.Context, b bool)`<br/> JS: `WindowSetAlwaysOnTop(b: Boolen)`
2022-12-29 16:00:10 +11:00
### WindowSetPosition
Sets the window position relative to the monitor the window is currently on.
2024-02-08 21:28:28 +11:00
Go: `WindowSetPosition(ctx context.Context, x int, y int)`<br/> JS: `WindowSetPosition(x: number, y: number)`
2022-12-29 16:00:10 +11:00
### WindowGetPosition
Gets the window position relative to the monitor the window is currently on.
2024-02-08 21:28:28 +11:00
Go: `WindowGetPosition(ctx context.Context) (x int, y int)`<br/> JS: `WindowGetPosition() : Position`
2022-12-29 16:00:10 +11:00
### WindowMaximise
Maximises the window to fill the screen.
2024-02-08 21:28:28 +11:00
Go: `WindowMaximise(ctx context.Context)`<br/> JS: `WindowMaximise()`
2022-12-29 16:00:10 +11:00
### WindowUnmaximise
Restores the window to the dimensions and position prior to maximising.
2024-02-08 21:28:28 +11:00
Go: `WindowUnmaximise(ctx context.Context)`<br/> JS: `WindowUnmaximise()`
2022-12-29 16:00:10 +11:00
### WindowIsMaximised
Returns true if the window is maximised.
2024-02-08 21:28:28 +11:00
Go: `WindowIsMaximised(ctx context.Context) bool`<br/> JS: `WindowIsMaximised() bool`
2022-12-29 16:00:10 +11:00
### WindowToggleMaximise
Toggles between Maximised and UnMaximised.
2024-02-08 21:28:28 +11:00
Go: `WindowToggleMaximise(ctx context.Context)`<br/> JS: `WindowToggleMaximise()`
2022-12-29 16:00:10 +11:00
### WindowMinimise
Minimises the window.
2024-02-08 21:28:28 +11:00
Go: `WindowMinimise(ctx context.Context)`<br/> JS: `WindowMinimise()`
2022-12-29 16:00:10 +11:00
### WindowUnminimise
Restores the window to the dimensions and position prior to minimising.
2024-02-08 21:28:28 +11:00
Go: `WindowUnminimise(ctx context.Context)`<br/> JS: `WindowUnminimise()`
2022-12-29 16:00:10 +11:00
### WindowIsMinimised
Returns true if the window is minimised.
2024-02-08 21:28:28 +11:00
Go: `WindowIsMinimised(ctx context.Context) bool`<br/> JS: `WindowIsMinimised() bool`
2022-12-29 16:00:10 +11:00
### WindowSetBackgroundColour
2024-02-08 21:28:28 +11:00
Sets the background colour of the window to the given RGBA colour definition. This colour will show through for all transparent pixels.
2022-12-29 16:00:10 +11:00
Valid values for R, G, B and A are 0-255.
:::info Windows
2024-02-08 21:28:28 +11:00
On Windows, only alpha values of 0 or 255 are supported. Any value that is not 0 will be considered 255.
2022-12-29 16:00:10 +11:00
:::
2024-02-08 21:28:28 +11:00
Go: `WindowSetBackgroundColour(ctx context.Context, R, G, B, A uint8)`<br/> JS: `WindowSetBackgroundColour(R, G, B, A)`
2022-12-29 16:00:10 +11:00
2023-09-06 19:45:08 +10:00
### WindowPrint
Opens tha native print dialog.
2024-02-08 21:28:28 +11:00
Go: `WindowPrint(ctx context.Context)`<br/> JS: `WindowPrint()`
2023-09-06 19:45:08 +10:00
2022-12-29 16:00:10 +11:00
## TypeScript Object Definitions
### Position
```ts
interface Position {
x: number;
y: number;
}
```
### Size
```ts
interface Size {
w: number;
h: number;
}
```