API:WindowSetMoving
From RoR Wiki
UI Lua API · Window functions
Version: WAR 1.4.8
Starts or stops moving a window with the mouse.
WindowSetMoving(windowName, moving)
Arguments
- windowName
string– Name of the window.- moving
boolean–trueto start moving the window,falseto stop.
Returns
Nothing.
Details
- This is what the client does itself when the left mouse button is pressed on a movable window. Calling it with
trueworks even if the window is not movable (see WindowSetMovable). - When a move starts, the client records the current mouse position.
- If the window is already in the requested state, nothing happens.
- When the state changes, the client can call the window's
OnSetMovingcore event handler with the new state (see WindowRegisterCoreEventHandler). - Hiding a window that is being moved ends the move.
movingmust be a real boolean. Passingnilor a number raises an Invalid Parameters error.- The function needs at least two arguments and only reads the last two.
Errors
Error in function call 'WindowSetMoving': Window %s does not existError in function call 'WindowSetMoving': Window %s is currently locked and may not be modified from lua. ...
This check never triggers in the current client. See WindowSetShowing.
Example
The layout editor starting and ending a move, from easystem_layouteditor/source/layoutcontrolframe.lua:
function LayoutControlFrame:BeginMoving()
-- ...
self.m_moving = true
WindowSetMoving( self:GetName(), true )
-- ...
end
function LayoutControlFrame:EndMoving()
-- ...
self.m_moving = false
WindowSetMoving( self:GetName(), false )
-- ...
end
