Skip to content

Window ​

Require path: require "ProjectMotionUI/Components/Window"


Class PMUI.Window ​

Inherits from: PMUI.Frame

Methods & Functions ​

PMUI.Window:new(title, width, height) ​

Creates a window with a draggable header, title, close button, and content area.

ParameterTypeDescription
titlestring|nilWindow title. Defaults to "Window".
widthnumber|nilInitial window width. Defaults to 360.
heightnumber|nilInitial window height. Defaults to 280.

Returns: PMUI.Window

PMUI.Window:SetTexture(textureOrPath) ​

Sets the window background texture. When a texture is assigned, the header background and border are made transparent.

ParameterTypeDescription
textureOrPathstring|Texture|nilTexture object or path to a texture.

Returns: PMUI.Window

PMUI.Window:SetOpenSound(soundName) ​

Sets the sound played when the window is opened.

ParameterTypeDescription
soundNamestring|nilUI sound name.

Returns: PMUI.Window

PMUI.Window:SetCloseSound(soundName) ​

Sets the sound played when the window is closed.

ParameterTypeDescription
soundNamestring|nilUI sound name.

Returns: PMUI.Window

PMUI.Window:SetCornerRadius(radius) ​

Sets the corner radius of the window and its header. The header uses the top-corners-only mode to preserve the window shape.

ParameterTypeDescription
radiusnumberCorner radius in pixels.

Returns: PMUI.Window

PMUI.Window:SetHeaderColor(r, g, b, a) ​

Sets the background color of the window header.

ParameterTypeDescription
rnumberRed component (0.0-1.0).
gnumberGreen component (0.0-1.0).
bnumberBlue component (0.0-1.0).
anumber|nilAlpha component (0.0-1.0).

Returns: PMUI.Window

PMUI.Window:OnClose(callback) ​

Registers a callback invoked when the window is closed. The callback receives the window instance.

ParameterTypeDescription
callbackfunction|nilClose callback.

Returns: PMUI.Window

PMUI.Window:Close() ​

Closes the window. Invokes the close callback, plays the configured sound, and fades out the window. Registered instances are removed through PMUI.CloseInstance after the fade-out completes.