API:WindowSetOffsetFromParent
From RoR Wiki
UI Lua API · Window functions
Version: WAR 1.4.8
Moves a window to a position relative to its parent's top-left corner.
WindowSetOffsetFromParent(windowName, x, y)
Arguments
- windowName
string– Name of the window.- x, y
number– New offset of the window's top-left corner from its parent's top-left corner, before the window's scale is applied.
Returns
Nothing.
Details
- The client multiplies
xandyby the window's scale (WindowGetScale) and stores the result in screen pixels. WindowGetOffsetFromParent uses the same units. - If the position does not change, nothing happens. Otherwise the window and its children move.
- The client may change the offset to keep the window on screen. See WindowIsSticky.
- The window's anchors are not removed. When they are processed again (for example by WindowForceProcessAnchors), they set the position again. Clear the anchors first with WindowClearAnchors if the window should stay where you put it.
Errors
Error in function call 'WindowSetOffsetFromParent': Window %s does not existError in function call 'WindowSetOffsetFromParent': Window %s is currently locked and may not be modified from lua. ...
This check never triggers in the current client. See WindowSetShowing.
Example
Moving floating combat text a little each frame, from easystem_eventtext/source/system_eventtext.lua:
self.m_AnimationData.current.x = self.m_AnimationData.current.x + stepX self.m_AnimationData.current.y = self.m_AnimationData.current.y + stepY -- This system doesn't use the standard window animation system due to the speed-variable animations. WindowSetOffsetFromParent(self:GetName(), self.m_AnimationData.current.x, self.m_AnimationData.current.y)
