Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:WindowIsSticky

From RoR Wiki

UI Lua API · Window functions
Version: WAR 1.4.8

Returns whether the client keeps a window on screen when it is moved.

sticky = WindowIsSticky(windowName)

Arguments

windowName
string – Name of the window.

Returns

sticky
boolean – false if the window may be moved partly off screen, true otherwise.

Details

  • Each window has a screen-clamping mode that the client checks whenever the window's position or size changes (for example through WindowSetOffsetFromParent or WindowSetDimensions). The modes found in the client code are:
    • Full clamping: the window is pushed back so that it stays entirely on the screen, and its width and height are limited to the screen size divided by its scale.
    • Loose clamping: only the window's top-left corner is kept from going past the right and bottom edges of the screen. The rest of the window can leave the screen.
    • Any other mode: no clamping.
  • WindowIsSticky returns false only for loose clamping.
  • The stock layout editor uses it to decide how far a window may be dragged off screen (see the example).

Errors

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

Example

From easystem_layouteditor/source/layoutcontrolframe.lua:

local sourceIsSticky = WindowIsSticky( self.m_activeFrame:GetSourceWindowName() )

-- Don't allow more than the "grabby bars" to go off the screen if the source window is sticky...
local scaledWidthOffset     = LayoutControlFrame.OFFSET * uiScale
local scaledHeightOffset    = LayoutControlFrame.OFFSET * uiScale

-- Allow 90% of the window to go off the screen if the source is not sticky (so we don't lose the LayoutFrame)
if( sourceIsSticky == false )
then
    -- ...
end

See also