Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:WindowGetOffsetFromParent

From RoR Wiki

UI Lua API · Window functions
Version: WAR 1.4.8

Returns the position of a window's top-left corner relative to its parent's top-left corner.

x, y = WindowGetOffsetFromParent(windowName)

Arguments

windowName
string – Name of the window.

Returns

x, y
number – Offset from the parent's top-left corner, divided by the window's scale.

Details

  • The client keeps the offset in screen pixels and divides it by the window's scale (WindowGetScale) before returning it. These are the same units that WindowSetOffsetFromParent takes.
  • To get screen pixels, multiply by the window's scale. The stock alert text window does this before starting a position animation (see the example).
  • The offset is the current position, whether it came from anchors, from WindowSetOffsetFromParent or from an animation.

Errors

  • Error in function call 'WindowGetOffsetFromParent': Window %s does not exist

Example

From ea_alerttextwindow/source/alerttextwindow.lua:

local x, y = WindowGetOffsetFromParent( oldestWindowName )
-- ...
local uiScale = InterfaceCore.GetScale()
x = uiScale * x
y = uiScale * y

See also