Window

Window is the base level window definition.  All other window elements inherit from ‘Window’, and therefore contain all of the attributes, elements, data members, and support all the same functions.

Summary
WindowWindow is the base level window definition.
XML DefinitionThis is the base level window definition.
XML Tag
Required AttributesRequired for the window element to create itself properly.
nameName of the window.
Optional AttributesThese are optional.
inheritsAllows you to inherit attributes from another window element.
layerThis defines the UI for the window.
movableAllows the window to be moved by clicking and dragging.
popablePops the window to the top of the layer when clicked.
taborderThe order through which tab cycles focus.
idA numerical id number, needs not be unique.
handleinputShould the window element process mouse events? 
skipinputThis flag allows a window to pass input to it’s child elements without handling it itself.
Constants
Constants
Animation Types
Window Layers
Game Action Buttons
Functions
Functions
WindowRegisterCoreEventHandler()Registers a lua callback for a game event.
WindowUnregisterCoreEventHandler()Clear’s the window’s current callback for an event.
Functions
Functions
WindowRegisterEventHandler()Registers a lua callback for a game event.
WindowUnregisterEventHandler()Clear’s the window’s current callback for an event.
WindowSetId()Set’s the id value for the window
WindowGetId()Returns the id for the specified window.
WindowSetTabOrder()Set’s the tab order for the window
WindowGetTabOrder()Returns the TabOrder for the specified window.
WindowSetAlpha()Sets the alpha value for the window’s texture elements.
WindowGetAlpha()Returns the current alpha value for the window.
WindowSetTintColor()Sets the tint color window’s texture elements.
WindowGetTintColor()Returns the tint color window’s texture elements.
WindowSetFontAlpha()Sets the alpha value for the window’s text elements.
WindowGetFontAlpha()Returns the current font alpha value for the window.
WindowSetOffsetFromParent()Sets the position of the window from it’s parent.
WindowGetOffsetFromParent()Returns window’s offset from it’s parent window.
WindowGetScreenPosition()Returns the screen position of the window.
WindowSetDimensions()Sets the x, y size of the window.
WindowGetDimensions()Returns the x, y size of the window.
WindowSetShowing()Sets if a window should be shown (and drawn) on the screen.
WindowGetShowing()Returns if the window is currently shown (and being drawn) on the screen.
WindowSetLayer()Sets the layer that the window should be drawn on.
WindowGetLayer()Returns if the layer the window is currently drawn on.
WindowSetHandleInput()Sets if the window should handle mouse input.
WindowGetHandleInput()Returns if the the is window currently handling mouse input.
WindowSetPopable()Returns if the window is currently set to popable.
WindowGetPopable()Returns if the window is currently set to popable.
WindowSetMovable()Sets if a window can be moved.
WindowGetMovable()Returns if the window can be moved with the mouse.
WindowIsSticky()Determines whether or not the window is sticky or unsticky.
WindowSetMoving()Sets if the window is currently attached to the cursor.
WindowGetMoving()Returns if the window is currently being moved.
WindowClearAnchors()Clears all of the anchors from the window.
WindowAddAnchor()Adds a new anchor to the window.
WindowGetAnchorCount()Returns how many anchors this window has.
WindowGetAnchor()Returns anchor information
WindowForceProcessAnchors()Forces the window anchors to be processed.
WindowAssignFocus()Assigns or clears the direct focus to this window element.
WindowHasFocus()Returns whether or not the window has focus.
WindowSetResizing()Sets the window to be continuously resized while the mouse is dragging.
WindowGetResizing()Returns if a window is currently being resized
WindowStartAlphaAnimation()Starts an automated alpha-animation on the window derived from the function parameters.
WindowStopAlphaAnimation()Stops the current alpha animation and reset’s the window to it’s true alpha value.
WindowStartPositionAnimation()Starts an automated position-animation on the window derived from the function parameters.
WindowStopPositionAnimation()Stops the current position animation and reset’s the window to it’s anchored position.
WindowStartScaleAnimation()Starts an automated scale-animation on the window derived from the function parameters.
WindowStopScaleAnimation()Stops the current scale animation and reset’s the window to it’s true scale.
WindowSetParent()This will remove the window from it’s current parent, and adds it as a child of the specified window.
WindowGetParent()Returns the parent for the specified window.
WindowSetScale()Sets the current scale value on the window.
WindowGetScale()Returns the current scale value on the window.
WindowSetRelativeScale()Scales the window relative to it’s current scale.
DoesWindowExist()Determines the existence of the specified window.
WindowResizeOnChildren()Resizes a parent window based upon the max sizes of its children
WindowSetGameActionTrigger()Associates a a key-bindable action to clicking on this window.
WindowSetGameActionData()Associates a game action (a key-bindable action) to clicking on this window.
WindowSetGameActionButton()Sets the GameActionButton to use to trigger the Game Action associated with this window.
WindowGetGameActionButton()Returns if the current button used to trigger game actions.
WindowIsGameActionLocked()Returns if this window is currently locked for editing game actions.
WindowSetDrawWhenInterfaceHidden()This function sets if the window should be drawn if the main UI is hidden.
WindowRestoreDefaultSettings()This function restores a window to it’s default anchors, size, scale, and alpha

XML Definition

This is the base level window definition.  All other window components also have Window definitions.

Summary
XML Tag
Required AttributesRequired for the window element to create itself properly.
nameName of the window.
Optional AttributesThese are optional.
inheritsAllows you to inherit attributes from another window element.
layerThis defines the UI for the window.
movableAllows the window to be moved by clicking and dragging.
popablePops the window to the top of the layer when clicked.
taborderThe order through which tab cycles focus.
idA numerical id number, needs not be unique.
handleinputShould the window element process mouse events? 
skipinputThis flag allows a window to pass input to it’s child elements without handling it itself.

XML Tag

<Window>
....
</Window>

Required Attributes

Required for the window element to create itself properly.

name

Name of the window.  Must be unique across all the entire interface.

Expects

  • A string value

Notes

Inside of a name tag you may insert the “$parent” tag to pre-pend the parent window’s name.  For example, the following two code segments result in the same window name:

<Window name="TargetWindow" >
<Windows>
<Window name="$parentBackground/>
</Windows>
</Window>

<Window name="TargetWindow" >
<Windows>
<Window name="TargetWindowBackground/>
</Windows>
</Window>

Optional Attributes

These are optional.  You can use whichever apply to the window you are creating.

inherits

Allows you to inherit attributes from another window element.  The inheritance type must be of the same window the window type you are creating.  For example, a button may only inherit a button definition, while a label may only inherit a label definition.

Expects

  • A string value, which is the name of any valid window definition of same type.

Default Value

  • blank ( “” )

layer

This defines the UI for the window.  All a single layer are drawn on top of all layers below them.  Within a single layer, windows can be set to popable such that they can be clicked on and brought to the top of their layer’s draw order.  This is most often used for secondary windows on the UI.

Expects

A string value, that is one of the following

  • ”background”
  • ”default”
  • ”secondary”
  • ”popup”
  • ”overlay”

Default Value

  • ”default”

movable

Allows the window to be moved by clicking and dragging.  Windows that are set to movable will always handle LButtonDown and LButtonUp events, clicks inside a movable window will never go through to the world.

Expects

The word “true” or “false”

  • true: Yes, allow the window to be dragged with the mouse.
  • false: No, the window cannot be moved with the mouse.

Default Value

  • ”true”

Related Functions

popable

Pops the window to the top of the layer when clicked.  The window will be moved to the top of it’s layer’s draw order.  This is the same as clicking on a window to bring it into focus.  By setting ‘popable’ to false, you can enforce the draw order of windows within the same layer.

Expects

The word “true” or “false”

  • true: Yes, pop the window when clicked.
  • false: No, never change the window’s position in the draw order.

Default Value

  • ”true”

taborder

The order through which tab cycles focus.  For a given window, all child elements may have a tab order value set on them.  When a tab order is set, the first element in the order will automatically gain focus when the window is shown.  This is useful for defaulting the focus to an edit box when you open up a window.

Expects

A number 0max number of items in the tab order for it’s parent window.

Default Value

  • 0 - no tab order

id

A numerical id number, needs not be unique.  This is most commonly used for creating a single callback for a series of elements.

Expects

Any integer value.  Negative values are allowed.

Default Value

  • 0

Related Functions

handleinput

Should the window element process mouse events?  When set to false, this will prevent the UI from processing any click and mouseover events within this window or any of it’s children.  This flag is most useful for two purposes:

  • If this is a first level window, allow the player to click always click through the window into the world.
  • To build complex window elements that consist of several pices, but force the mouse to respond to their parent.

Expects

The word “true” or “false”

  • true: Yes, process mouse events.
  • false: No, ignore all mouse events.

Default Value

  • ”true”

skipinput

This flag allows a window to pass input to it’s child elements without handling it itself.  Child windows still must be contained within their parent to receive clicks, but the parent window will neither process button clicks or mouse over.  This is useful for creating large container windows that are used only for layout purposes and will not process buton events.

Constants

Constants

Animation Types

Window.AnimationType.SINGLESmoothly fades between between the start and end values, then returns to the previous value when complete.
Window.AnimationType.SINGLE_NO_RESETSmoothly fades between the start and end values, but does not reset the value when complete.
Window.AnimationType.EASE_OUTSingle pass, fades more quickly when approaching the end value.  Similar to SINGLE_NO_RESET, but with parabolic interopolation.
Window.AnimationType.LOOPSmoothly fades between the start->end->start->end continousely.
Window.AnimationType.REPEATSmoothly fades bewtween start->end, start->end continously.
Window.AnimationType.POPFades form start->end, holds, then fades from end->start at the same rate it faded in.
Window.AnimationType.POP_AND_EASEFades from start->end quickly, holds, then fades from end->start slowly.

Window Layers

Window.Layers.BACKGROUNDCorresponds to the “background” value in xml.
Window.Layers.DEFAULTCorresponds to the “default” value in xml.
Window.Layers.SECONDARYCorresponds to the “secondary” value in xml.
Window.Layers.POPUPCorresponds to the “popup” value in xml.
Window.Layers.OVERLAYCorresponds to the “overlay” value in xml.

Game Action Buttons

Window.GameActionButtons.LEFTCorresponds to the “left” value in xml.
Window.GameActionButtons.RIGHTCorresponds to the “right” value in xml.

Functions

Summary
Functions
WindowRegisterCoreEventHandler()Registers a lua callback for a game event.
WindowUnregisterCoreEventHandler()Clear’s the window’s current callback for an event.

Functions

WindowRegisterCoreEventHandler()

Registers a lua callback for a game event.

Parameters

windowName(string) The name of the window.
eventName(string) The name of the event for which to register a callback.
callback(string) Full name of the lua function to be called when this event occurs.

Returns

nilno return value

Notes

Each window may only have one callback may be registered for a particular core event.  If a callback is already registered, an error message will be printed to the <UiLog>.  If you wish to change your event Registeration, you must first call WindowUnregisterEventHandler with the old event as a paramater.

Example

WindowRegisterCoreEventHandler(
"PlayerWindow", "OnMouseOver", "PlayerWindow.OnMouseOver")

WindowUnregisterCoreEventHandler()

Clear’s the window’s current callback for an event.

Parameters

windowName(string) The name of the window.
eventName(string) The id name of the event for which to unregister a callback.

Returns

nilno return value

Notes

  • none

Example

WindowUnregisterCoreEventHandler( "PlayerWindow", "OnMouseOver" )

Functions

Summary
Functions
WindowRegisterEventHandler()Registers a lua callback for a game event.
WindowUnregisterEventHandler()Clear’s the window’s current callback for an event.
WindowSetId()Set’s the id value for the window
WindowGetId()Returns the id for the specified window.
WindowSetTabOrder()Set’s the tab order for the window
WindowGetTabOrder()Returns the TabOrder for the specified window.
WindowSetAlpha()Sets the alpha value for the window’s texture elements.
WindowGetAlpha()Returns the current alpha value for the window.
WindowSetTintColor()Sets the tint color window’s texture elements.
WindowGetTintColor()Returns the tint color window’s texture elements.
WindowSetFontAlpha()Sets the alpha value for the window’s text elements.
WindowGetFontAlpha()Returns the current font alpha value for the window.
WindowSetOffsetFromParent()Sets the position of the window from it’s parent.
WindowGetOffsetFromParent()Returns window’s offset from it’s parent window.
WindowGetScreenPosition()Returns the screen position of the window.
WindowSetDimensions()Sets the x, y size of the window.
WindowGetDimensions()Returns the x, y size of the window.
WindowSetShowing()Sets if a window should be shown (and drawn) on the screen.
WindowGetShowing()Returns if the window is currently shown (and being drawn) on the screen.
WindowSetLayer()Sets the layer that the window should be drawn on.
WindowGetLayer()Returns if the layer the window is currently drawn on.
WindowSetHandleInput()Sets if the window should handle mouse input.
WindowGetHandleInput()Returns if the the is window currently handling mouse input.
WindowSetPopable()Returns if the window is currently set to popable.
WindowGetPopable()Returns if the window is currently set to popable.
WindowSetMovable()Sets if a window can be moved.
WindowGetMovable()Returns if the window can be moved with the mouse.
WindowIsSticky()Determines whether or not the window is sticky or unsticky.
WindowSetMoving()Sets if the window is currently attached to the cursor.
WindowGetMoving()Returns if the window is currently being moved.
WindowClearAnchors()Clears all of the anchors from the window.
WindowAddAnchor()Adds a new anchor to the window.
WindowGetAnchorCount()Returns how many anchors this window has.
WindowGetAnchor()Returns anchor information
WindowForceProcessAnchors()Forces the window anchors to be processed.
WindowAssignFocus()Assigns or clears the direct focus to this window element.
WindowHasFocus()Returns whether or not the window has focus.
WindowSetResizing()Sets the window to be continuously resized while the mouse is dragging.
WindowGetResizing()Returns if a window is currently being resized
WindowStartAlphaAnimation()Starts an automated alpha-animation on the window derived from the function parameters.
WindowStopAlphaAnimation()Stops the current alpha animation and reset’s the window to it’s true alpha value.
WindowStartPositionAnimation()Starts an automated position-animation on the window derived from the function parameters.
WindowStopPositionAnimation()Stops the current position animation and reset’s the window to it’s anchored position.
WindowStartScaleAnimation()Starts an automated scale-animation on the window derived from the function parameters.
WindowStopScaleAnimation()Stops the current scale animation and reset’s the window to it’s true scale.
WindowSetParent()This will remove the window from it’s current parent, and adds it as a child of the specified window.
WindowGetParent()Returns the parent for the specified window.
WindowSetScale()Sets the current scale value on the window.
WindowGetScale()Returns the current scale value on the window.
WindowSetRelativeScale()Scales the window relative to it’s current scale.
DoesWindowExist()Determines the existence of the specified window.
WindowResizeOnChildren()Resizes a parent window based upon the max sizes of its children
WindowSetGameActionTrigger()Associates a a key-bindable action to clicking on this window.
WindowSetGameActionData()Associates a game action (a key-bindable action) to clicking on this window.
WindowSetGameActionButton()Sets the GameActionButton to use to trigger the Game Action associated with this window.
WindowGetGameActionButton()Returns if the current button used to trigger game actions.
WindowIsGameActionLocked()Returns if this window is currently locked for editing game actions.
WindowSetDrawWhenInterfaceHidden()This function sets if the window should be drawn if the main UI is hidden.
WindowRestoreDefaultSettings()This function restores a window to it’s default anchors, size, scale, and alpha

Functions

WindowRegisterEventHandler()

Registers a lua callback for a game event.

Parameters

windowName(string) The name of the window.
eventId(number) The id number of the event for which to register a callback.
callback(string) Full name of the lua function to be called when this event occurs.

Returns

nilno return value

Notes

Each window may only have one callback may be registered for a particular event.  If a callback is already registered, an error message will be printed to the <UiLog>.  If you wish to change your event Registeration, you must first call WindowUnregisterEventHandler with the old event as a paramater.

Example

WindowRegisterEventHandler(
"PlayerWindow", SystemData.Events.PLAYER_CUR_HIT_POINTS_UPDATED, "PlayerWindow.UpdateCurrentHitPoints")

WindowUnregisterEventHandler()

Clear’s the window’s current callback for an event.

Parameters

windowName(string) The name of the window.
eventId(number)The id number of the event for which to unregister a callback.

Returns

nilno return value

Notes

  • none

Example

WindowUnregisterEventHandler( "PlayerWindow", SystemData.Events.PLAYER_CUR_HIT_POINTS_UPDATED )

WindowSetId()

Set’s the id value for the window

Parameters

windowName(string) The name of the window.
id(number) The id number to assign to the window.  May be any integer value.

Returns

nilno return value

Related XML

Notes

The id number for a window needs not be unique.  The window’s name is its unique identify, so the id value is entirely defined by it’s use in xml/lua.

Example

WindowSetId( "GroupWindowMember3", 3 )

WindowGetId()

Returns the id for the specified window.

Parameters

windowName(string) The name of the window.

Returns

id(number) The id number for the window.

Related XML

Notes

The id number for a window needs not be unique.  The window’s name is its unique identify, so the id value is entirely defined by it’s use in xml/lua.

Example

local index = WindowGetId( <SystemData.ActiveWindow.name> )

WindowSetTabOrder()

Set’s the tab order for the window

Parameters

windowName(string) The name of the window.
tabOrder(number) The TabOrder number to assign to the window.  May be any integer value.

Returns

nilno return value

Related XML

Notes

Example

WindowSetTabOrder( "EditBox1", 1 )

WindowGetTabOrder()

Returns the TabOrder for the specified window.

Parameters

windowName(string) The name of the window.

Returns

TabOrder(number) The tab order number for the window.

Related XML

  • <tabOrder>

Notes

Example

local tabOrder = WindowGetTabOrder( <SystemData.ActiveWindow.name> )

WindowSetAlpha()

Sets the alpha value for the window’s texture elements.  This value is propagated to all child elements as the ‘parent alpha’ value.  A window’s alpha and parent alpha values are multiples to produce the combined alpha result seen on the screen.

Parameters

windowName(string) The name of the window.
alpha(number) The alpha value 0.0 to 1.0.

Returns

nilno return value.

Notes

If you want to animate the alpha for a window element, it is better to use the animation functions rather than directly call WindowSetAlpha every frame.  See:

Example

WindowSetAlpha( "ChatBubbleWindow"..index, 0.5 )

WindowGetAlpha()

Returns the current alpha value for the window.

Parameters

windowName(string) The name of the window.

Returns

alpha(number) The alpha value 0.0 to 1.0.

Notes

This alpha value is the value set for this particular window element.  The perceived alpha value may be less if one of the window’s parent elements has less an alpha value < 1.0.

Example

local alpha = WindowGetAlpha( "ChatBubbleWindow"..index, 0.5 )

WindowSetTintColor()

Sets the tint color window’s texture elements.

Parameters

windowName(string) The name of the window.
red(number) The red tint value (0-255)
green(number) The green tint value (0-255)
blue(number) The blue tint value (0-255)

Returns

nilno return value.

Related XML

  • <TintColor>

Notes

none

Example

local row_mod = math.mod (rowIndex, 2)
local color = DataUtils.GetAlternatingRowColor( row_mod )
WindowSetTintColor("KeyMappingWindowActionsListRow"..rowIndex.."BackgroundName", color.r, color.g, color.b);

WindowGetTintColor()

Returns the tint color window’s texture elements.

Parameters

windowName(string) The name of the window.

Returns

red(number) The red tint value (0-255)
green(number) The green tint value (0-255)
blue(number) The blue tint value (0-255)

Related XML

  • <TintColor>

Notes

The values may be outside the range of 0..255 if the tint color falls outside the 0..1 range.

Example

local r, g, b = WindowGetTintColor("TargetWindowPortraitBackground")

WindowSetFontAlpha()

Sets the alpha value for the window’s text elements.  This value is propagated to all child elements.

Parameters

windowName(string) The name of the window.
alpha(number) The alpha value 0.0 to 1.0.

Returns

nilno return value.

Notes

none

Example

WindowSetFontAlpha( "ChatBubbleWindow"..index., 0.5 )

WindowGetFontAlpha()

Returns the current font alpha value for the window.

Parameters

windowName(string) The name of the window.

Returns

alpha(number) The alpha value 0.0 to 1.0.

Notes

none

Example

local fontAlpha = WindowGetFontAlpha( "ChatBubbleWindow"..index )

WindowSetOffsetFromParent()

Sets the position of the window from it’s parent.

Parameters

windowName(string) The name of the window.
xOffset(number) The x pixel offset from the parent’s top left corner.
yOffset(number) The y Pixel offset from the parent’s top left corner.

Returns

nilno return value.

Notes

  • This function manually moves the window without modifying any of its anchors.  If you wish for the window to anchor correctly, call WindowClearAnchors and then WindowAddAnchor with the appropriate parameters.
  • If you move a window outside of it’s parent’s dimensions, the window will not recieve mouse events as they will be culled by the parent’s size.

Example

WindowSetOffsetFromParent( "ChatWindow", SystemData.Settings.Chat.windowPos.x, SystemData.Settings.Chat.windowPos.y )

WindowGetOffsetFromParent()

Returns window’s offset from it’s parent window.

Parameters

windowName(string) The name of the window.

Returns

xOffset(number) The x pixel offset from the parent’s top left corner.
yOffset(number) The y Pixel offset from the parent’s top left corner.

Notes

The window’s offset from parent is not the same as the window’s screen position.  Use WindowGetScreenPosition instead of you need the the screen position.

Example

WindowSetOffsetFromParent( "ChatWindow", SystemData.Settings.Chat.windowPos.x, SystemData.Settings.Chat.windowPos.y )

WindowGetScreenPosition()

Returns the screen position of the window.

Parameters

windowName(string) The name of the window.

Returns

xOffset(number) The x pixel of the top left corner.
yOffset(number) The y Pixel of the top corner.

Notes

none

Example

local mouseoverX, mouseoverY    = WindowGetScreenPosition (Tooltips.curMouseOverWindow);

WindowSetDimensions()

Sets the x, y size of the window.

Parameters

windowName(string) The name of the window.
xOffset(number) The x unscaled size
yOffset(number) The y unscaled size.

Returns

nilno return value

Notes

Dimensions area always specified in UNSCALED coordinates.  The dimensions and window scale are combined internal to produce the sizes shown on the screen.  You should use the same scale when specifying sizes in both xml and lua.

Example

WindowSetDimensions( "QuestTrackerWindow", totalWidth, height)

WindowGetDimensions()

Returns the x, y size of the window.

Parameters

windowName(string) The name of the window.

Returns

xOffset(number) The x unscaled size
yOffset(number) The y unscaled size.

Notes

Dimensions area always specified in UNSCALED coordinates.  The dimensions and window scale are combined internal to produce the sizes shown on the screen.  You should use the same scale when specifying sizes in both xml and lua.

Example

local x, y = WindowGetDimensions( "MapPointsTooltipInfo"..index )

WindowSetShowing()

Sets if a window should be shown (and drawn) on the screen.  When a window is not showing, it will not receive updates or mouse events.  Generic event handlers will still be processed.

Parameters

windowName(string) The name of the window.
showing(boolean) Should the window be drawn?

Returns

nilno return value

Notes

  • If a window is popable, it will be popped to the top of it’s layer when shown.
  • If a window’s children have a specifed taborder, the first item will have focus when shown.

Example

WindowSetShowing("QuestTrackerWindowMinMaxToggleMaxButton", QuestTrackerWindow.isMinimized == true)

WindowGetShowing()

Returns if the window is currently shown (and being drawn) on the screen.

Parameters

windowName(string) The name of the window.

Returns

showing(boolean) Is the window currently being drawn?

Notes

none

Example

local showing = WindowGetShowing( "QuestTrackerWindow" )

WindowSetLayer()

Sets the layer that the window should be drawn on.

Parameters

windowName(string) The name of the window.
layer(number) The layer the window is drawn on.  See Window Layers for values.

Returns

nilno return value

Related XML

Notes

  • none

Example

none

WindowGetLayer()

Returns if the layer the window is currently drawn on.

Parameters

windowName(string) The name of the window.

Returns

layer(number) The layer the window is drawn on.  See Window Layers for values.

Notes

none

Example

local layer = WindowGetLayer( "" )

WindowSetHandleInput()

Sets if the window should handle mouse input.

Parameters

windowName(string) The name of the window.
handleinput(number) Should the window handle mouse input?

Returns

nilno return value

Related XML

Notes

  • none

Example

none

WindowGetHandleInput()

Returns if the the is window currently handling mouse input.

Parameters

windowName(string) The name of the window.

Returns

handlingInput(boolean) Is the window currently handling mouse input?

Notes

none

Example

local isHandlingInput = WindowGetHandleInput( "SomeWindow" )

WindowSetPopable()

Returns if the window is currently set to popable.  When popable is true, the window will ‘pop’ to the front of it’s layer when clicked.

Parameters

windowName(string) The name of the window.
popable(number) Should the window be popable?

Returns

nilno return value

Related XML

Notes

  • none

Example

none

WindowGetPopable()

Returns if the window is currently set to popable.

Parameters

windowName(string) The name of the window.

Returns

isPopable(boolean) Is the window popable

Notes

none

Example

local isPopable = WindowGetPopable( "SomeWindowName" )

WindowSetMovable()

Sets if a window can be moved.  When true, the window can be clicked on and dragged around the screen.

Parameters

windowName(string) The name of the window.
movable(boolean) Should the window be movable?

Returns

nilno return value

Related XML

Notes

  • This is a good option to use for windows that you would like to move occationally, but would like to prevent from moving most of the item.  This could be done by adding a right click menu with a ‘lock/unlock’ option.

Example

SystemData.Settings.Interface.lockTacticalMap = ButtonGetPressedFlag( "ScenarioMapMenuWindowLockButton" )
WindowSetMovable("ScenarioMapWindow", not SystemData.Settings.Interface.lockTacticalMap )

WindowGetMovable()

Returns if the window can be moved with the mouse.

Parameters

windowName(string) The name of the window.

Returns

movable(boolean) Is the window currently movable?

Notes

none

Example

local movable = WindowGetShowing( "ScenarioMapWindowMapImage" )

WindowIsSticky()

Determines whether or not the window is sticky or unsticky.

Parameters

windowName(string) The name of the window.

Returns

sticky (boolean)Is the window sticky?  True, or false.

Notes

  • Sticky is the attribute which says whether or not a window can move off the screen.

Example

none

WindowSetMoving()

Sets if the window is currently attached to the cursor.

Parameters

windowName(string) The name of the window.
moving(boolean) Should the window be moving?

Returns

nilno return value

Notes

  • This function allows you to override the normal LButtonDown and LButtonUP moving functionality on a window set to movable.

Example

none

WindowGetMoving()

Returns if the window is currently being moved.

Parameters

windowName(string) The name of the window.

Returns

moving(boolean) Is the window be moving?

Notes

  • none

Example

none

WindowClearAnchors()

Clears all of the anchors from the window.  When all the anchors are removed from a window, it will reposition itself to it’s parent position.

Parameters

windowName(string) The name of the window.

Returns

nilno return value

Related XML

  • <Anchors>

Notes

  • Clearing anchors in lua is very useful for dynamically reanchoring and positioning windows on the fly.

Example

See the Anchoring guide.

WindowAddAnchor()

Adds a new anchor to the window.

Parameters

windowName(string) The name of the window.
anchorPoint(string) The name point on the at which to anchor the window.  { “topleft”, “top”, “topright”, “left”, “center”, “right”, “bottomleft”, “bottom”, “bottomright” }
relativeTo(string) The name of another window to which you want to anchor this one.
relativePoint(string) The point on this that you wish to attach to the anchor window.  { “topleft”, “top”, “topright”, “left”, “center”, “right”, “bottomleft”, “bottom”, “bottomright” }
xOffset(number) The x pixel offset from this anchor location.
yOffset(number) The y pixel offset from this anchor location.

Returns

nilno return value

Related XML

  • <Anchor>

Notes

  • It is valid to have either one or two anchors on a window.
  • If a window has two anchors, the window will be automatically resized to fit the two parameters.

Example

See the Anchoring guide.

WindowGetAnchorCount()

Returns how many anchors this window has.

Parameters

windowName(string) The name of the window.

Returns

numberThe number of anchors this window has.

Related XML

  • <Anchor>

Notes

none

Example

none

WindowGetAnchor()

Returns anchor information

Parameters

windowName(string) The name of the window.
anchorId(number) Desired anchor’s id.  Ranges from 1 to WindowGetAnchorCount for this window.

Returns

(string)point
(string)relativePoint
(string)relativeTo
(number)x offset
(number)y offset

Related XML

  • <Anchor>

Notes

The return offset values are unscaled.

Example

local point, relativePoint, relativeTo, xOffs, yOffs = WindowGetAnchor (“MyWindow”, 1)

WindowForceProcessAnchors()

Forces the window anchors to be processed.

Parameters

windowName(string) The name of the window.

Returns

nilno return value

Related XML

  • <Anchor>

Notes

  • This is helpful to “fix” you window positions if you have done some odd combination of sizing/anchoring that is incorrect.

Example

none

WindowAssignFocus()

Assigns or clears the direct focus to this window element.  As a result, all parent window element will also come into focus.

Parameters

windowName(string) The name of the window.
focus(string) True = Set Focus, False = Clear Focus

Returns

nilno return value

Related XML

  • <Anchor>

Notes

  • Certain window elements, such as the EditBox can hold focus when they are not visible.  Be careful when showing/hiding elements that you have explicitly given focus.

Example

none

WindowHasFocus()

Returns whether or not the window has focus.

Parameters

windowName(string) The name of the window.

Returns

focus(boolean) True = Has Focus, False = No Focus

Related XML

  • <Anchor>

Notes

Example

none

WindowSetResizing()

Sets the window to be continuously resized while the mouse is dragging.

Parameters

windowName(string) The name of the window.
resizing(string) True = Resizing is on, False = Resizing is off.

Returns

nilno return value

Related XML

  • <Anchor>

Notes

  • Resizing can potentially very slow for complex windows.  Rather than resizing a window directy, use the <WindowUtils> <WindowUtils.BeginResize> and <WindowUtils.EndResize> functions that create a gray resizing box arround the window durring the resize, so the actually window dimensions are only updated once.

Example

none

WindowGetResizing()

Returns if a window is currently being resized

Parameters

windowName(string) The name of the window.

Returns

resizing(string) True = Resizing is on, False = Resizing is off.//*

Notes

  • none

Example

none

WindowStartAlphaAnimation()

Starts an automated alpha-animation on the window derived from the function parameters.

Parameters

windowName(string) The name of the window.
animType(number) The animation type, see Animation Types for valid values.
startAlpha(number) The starting alpha value for the animation.
endAlpha(number) The ending alpha value for the animation.
duration(number) The duration (in seconds) to fade between the min alpha and max alpha.
setStartBeforeDelay(boolean) Should the window be set to the start animation value prior to the delay?
delay(number) The delay between this function call and when the animation should start.
numLoop(number) The number of times to loop the animation.  When 0, looks indefinably.

Returns

nilno return value

Notes

  • You must issue a <StopAlphaAnimation()> call to end the animation.  This currently necessary even for single-pass animations.
  • The actual alpha value on the window is multiplied into the alpha fade.  If you set the window alpha in the middle of the animation, the value you set will not necesiarily be the value you see on screen until the animation stop.

Example

none

To Do

  • Remove DEPRECATED isIncreasing param
  • change all single-pass anim types to ‘stop’ automatically.

WindowStopAlphaAnimation()

Stops the current alpha animation and reset’s the window to it’s true alpha value.

Parameters

windowName(string) The name of the window.

Returns

nilno return value

Notes

  • none Example:

none

WindowStartPositionAnimation()

Starts an automated position-animation on the window derived from the function parameters.

Parameters

windowName(string) The name of the window.
animType(number) The animation type, see Animation Types for valid values.
startX(number) The starting x offset from parent for the animation (start and end for POP type anims)
startY(number) The starting y offset from parent for the animation (start and end for POP type anims)
endX(number) The ending x offset from parent for the animation (mid-point for POP type anims)
endY(number) The ending y offset from parent for the animation (mid-point for POP type anims)
duration(number) The duration (in seconds) to fade between the min alpha and max alpha.
setStartBeforeDelay(boolean) Should the window be set to the start animation value prior to the delay?
delay(number) The delay between this function call and when the animation should start.
numLoop(number) The number of times to loop the animation.  When 0, looks indefinably.

Returns

nilno return value

Notes

  • You must issue a <StopPositionaAnimation()> call to end the animation.  This currently necessary even for single-pass animations.
  • The animation will override the window’s anchors for the duration of the animation.

WindowStopPositionAnimation()

Stops the current position animation and reset’s the window to it’s anchored position.

Parameters

windowName(string) The name of the window.

Returns

nilno return value

Notes

  • none Example:

none

WindowStartScaleAnimation()

Starts an automated scale-animation on the window derived from the function parameters.

Parameters

windowName(string) The name of the window.
animType(number) The animation type, see Animation Types for valid values.
startAlpha(number) The starting alpha value for the animation.
endAlpha(number) The ending alpha value for the animation.
duration(number) The duration (in seconds) to fade between the min alpha and max alpha.
setStartBeforeDelay(boolean) Should the window be set to the start animation value prior to the delay?
delay(number) The delay between this function call and when the animation should start.
numLoop(number) The number of times to loop the animation.  When 0, looks indefinably.

Returns

nilno return value

Notes

  • You must issue a <StopAlphaAnimation()> call to end the animation.  This currently necessary even for single-pass animations.
  • The animation will override the actual scale value on the window for the duration of the animation.

Example

none

To Do

  • Remove DEPRECATED isIncreasing param
  • change all single-pass anim types to ‘stop’ automatically.

WindowStopScaleAnimation()

Stops the current scale animation and reset’s the window to it’s true scale.

Parameters

windowName(string) The name of the window.

Returns

nilno return value

Notes

  • none Example:

none

WindowSetParent()

This will remove the window from it’s current parent, and adds it as a child of the specified window.

Parameters

windowName(string) The name of the window.
parentWindowName(string) The name of the new parent window.

Returns

nilno return value

Notes

  • none

Example

none

WindowGetParent()

Returns the parent for the specified window.

Parameters

windowName(string) The name of the window.

Returns

parentWindowName(string) The name of the new parent window.

Notes

  • This function is very useful for nested window elements, where you want to use a parent window’s id number but still allow a child windows to process input and handle click events.

Example

local quest = WindowGetId( WindowGetParent( SystemData.ActiveWindow.name ) )

WindowSetScale()

Sets the current scale value on the window.

Parameters

windowName(string) The name of the window.
scale(number) Value between 0.0 and 1.0.

Returns

nilno return value

Notes

  • A window’s visual size on the screen are determined by multiplying it’s scale value and dimensions.

Example

none

WindowGetScale()

Returns the current scale value on the window.

Parameters

windowName(string) The name of the window.

Returns

scale(number) Value between 0.0 and 1.0.

Notes

  • A window’s visual size on the screen are determined by multiplying it’s scale value and dimensions.

Example

none

WindowSetRelativeScale()

Scales the window relative to it’s current scale.  For example, a relative scale of 0.5 will scale a window to half it’s current size.

Parameters

windowName(string) The name of the window.
scale(number) Value between 0.0 and 1.0.

Returns

nilno return value

Notes

  • A window’s visual size on the screen are determined by multiplying it’s scale value and dimensions.

Example

WindowSetRelativeScale( “SomeWindow”, 0.5 )

DoesWindowExist()

Determines the existence of the specified window.

Parameters

windowName(string) The name of the window.

Returns

exists(boolean) true if the window named by windowName exists, false otherwise.

Notes

Example

if (DoesWindowExist ("MySpecialWindow") == true) then
DEBUG (L"Thanks for avoiding error spew!");
end

WindowResizeOnChildren()

Resizes a parent window based upon the max sizes of its children

Parameters

windowName(string) Name of the parent window to resize.
recursive(boolean) Whether or not to recurse through the children of your children.
borderSpacing(number) Amount of padding to add to the bottom and right.

Returns

nilno return value.

Notes

none

Example

WindowResizeOnChildren( "BadlySizedParentWindow", true, 2 )

WindowSetGameActionTrigger()

Associates a a key-bindable action to clicking on this window.

Parameters

windowName(string) Name of the window
gameActionId(number) The keybinding action id to trigger when the window is clicked.

Returns

nilno return value.

Notes

none

Example

WindowSetGameActionTrigger( "SomeWindow", 2 )

WindowSetGameActionData()

Associates a game action (a key-bindable action) to clicking on this window.

Parameters

windowName(string) Name of the window
gameActionType(number) The Type of the action.
gameActionId(number) The id number of the action.
gameActionText(number) The text associated with the action.

Returns

nilno return value.

Notes

none

Example

WindowSetGameActionData( "SomeWindow", true, 2 )

WindowSetGameActionButton()

Sets the GameActionButton to use to trigger the Game Action associated with this window.

Parameters

windowName(string) The name of the window.
gameActionButton(number) The GameActionButton to use for this window see Game Action Buttons for values.

Returns

nilno return value

Related XML

  • <gameactionbutton>

Notes

  • none

Example

none

WindowGetGameActionButton()

Returns if the current button used to trigger game actions.

Parameters

windowName(string) The name of the window.

Returns

GameActionButton(number) The current GameAction button See Game Action Buttons for values.

Notes

none

Example

local button = WindowGetGameActionButton( "WindowName" )

WindowIsGameActionLocked()

Returns if this window is currently locked for editing game actions.

Parameters

windowName(string) The name of the window.

Returns

locked(number) Returns if the window is locked for game actions or not.

Notes

none

Example

local locked = WindowIsGameActionLocked( "WindowName" )

WindowSetDrawWhenInterfaceHidden()

This function sets if the window should be drawn if the main UI is hidden.

Parameters

windowName(string) The name of the window.
showWhenUiHidden(boolean) Should this window be drawn the the main UI is hidden?

Returns

nilno return value

Notes

  • none

Example

WindowSetDrawWhenInterfaceHidden( "SiegeWeaponCannonAimWindow", true )

WindowRestoreDefaultSettings()

This function restores a window to it’s default anchors, size, scale, and alpha

Parameters

windowName(string) The name of the window.

Returns

nilno return value

Notes

  • none

Example

WindowRestoreDefaultSettings( "OverheadMapWindow" )
Pops the window to the top of the layer when clicked.
Sets if a window can be moved.
Returns if the window can be moved with the mouse.
Set’s the id value for the window
Returns the id for the specified window.
Clear’s the window’s current callback for an event.
A numerical id number, needs not be unique.
The order through which tab cycles focus.
Starts an automated alpha-animation on the window derived from the function parameters.
Stops the current alpha animation and reset’s the window to it’s true alpha value.
Clears all of the anchors from the window.
Adds a new anchor to the window.
Returns the screen position of the window.
This defines the UI for the window.
Should the window element process mouse events? 
Allows the window to be moved by clicking and dragging.
This is a guide for how to use the Anchors xml tag and how to use the WindowClearAnchors() and WindowAddAnchor() functions to dynamically reposition windows on the fly.
Returns how many anchors this window has.