Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:WindowSetDimensions

From RoR Wiki

UI Lua API · Window functions
Version: WAR 1.4.8

Sets a window's width and height.

WindowSetDimensions(windowName, width, height)

Arguments

windowName
string – Name of the window.
width, height
number – New size, before the window's scale is applied.

Returns

Nothing.

Details

  • The size is in the window's own units. On screen it is multiplied by the window's scale (WindowGetScale).
  • Negative values are stored as 0.
  • For windows that are kept fully on screen (see WindowIsSticky), the width and height are also limited to the screen size divided by the window's scale.
  • If the size does not change, nothing else happens. Otherwise:
    • For windows with state tracking enabled, windowName.STATE.DIMENSION_X and DIMENSION_Y are updated (see WindowGetDimensions).
    • The client can call the window's OnSizeUpdated core event handler (see WindowRegisterCoreEventHandler) with the new width and height.
  • Afterwards the window's own anchors are processed again. A window with two anchors on opposite corners therefore gets its size back from the anchors; clear or change the anchors to resize it.
  • The root window cannot be resized.

Errors

  • Error in function call 'WindowSetDimensions': Window %s does not exist
  • Error in function call 'WindowSetDimensions': The dimensions of the root window cannot be changed.
  • Error in function call 'WindowSetDimensions': Window %s is currently locked and may not be modified from lua. ...
    This check never triggers in the current client. See WindowSetShowing.

Example

From easystem_dialogmanager/source/dialogmanager.lua:

local x, y = WindowGetDimensions( "OneButtonDlg"..dlgIndex.."Box" )
WindowSetDimensions ( "OneButtonDlg"..dlgIndex, x, y )

See also