<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3AWindowGetDimensions</id>
	<title>API:WindowGetDimensions - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3AWindowGetDimensions"/>
	<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:WindowGetDimensions&amp;action=history"/>
	<updated>2026-10-17T11:51:30Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.returnofreckoning.com/index.php?title=API:WindowGetDimensions&amp;diff=30869&amp;oldid=prev</id>
		<title>Maintenance script: UI Lua API import (WAR 1.4.8)</title>
		<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:WindowGetDimensions&amp;diff=30869&amp;oldid=prev"/>
		<updated>2026-10-16T19:51:28Z</updated>

		<summary type="html">&lt;p&gt;UI Lua API import (WAR 1.4.8)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{LuaApi|group=Window|wrapper=interfacecore/source/windowstate.lua}}&lt;br /&gt;
Returns a window&amp;#039;s width and height.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
width, height = WindowGetDimensions(windowName)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Arguments ==&lt;br /&gt;
;windowName : &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; – Name of the window.&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
;width, height : &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; – The window&amp;#039;s size, before its scale is applied.&lt;br /&gt;
&lt;br /&gt;
== Details ==&lt;br /&gt;
* The size is in the window&amp;#039;s own units. The size on screen is these values multiplied by the window&amp;#039;s scale ([[API:WindowGetScale|WindowGetScale]]).&lt;br /&gt;
* The client registers the C function as &amp;lt;code&amp;gt;_WindowGetDimensions&amp;lt;/code&amp;gt;. The &amp;lt;code&amp;gt;WindowGetDimensions&amp;lt;/code&amp;gt; that addons call is a Lua function defined in &amp;lt;code&amp;gt;interfacecore/source/windowstate.lua&amp;lt;/code&amp;gt;:&lt;br /&gt;
** If the global table named after the window (&amp;lt;code&amp;gt;_G[windowName]&amp;lt;/code&amp;gt;) has a &amp;lt;code&amp;gt;STATE&amp;lt;/code&amp;gt; table, it returns &amp;lt;code&amp;gt;STATE.DIMENSION_X&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;STATE.DIMENSION_Y&amp;lt;/code&amp;gt; without calling into the client.&lt;br /&gt;
** Otherwise it calls &amp;lt;code&amp;gt;_WindowGetDimensions(windowName)&amp;lt;/code&amp;gt;.&lt;br /&gt;
* For windows with state tracking enabled, the client writes the new size to &amp;lt;code&amp;gt;&amp;#039;&amp;#039;windowName&amp;#039;&amp;#039;.STATE.DIMENSION_X&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;DIMENSION_Y&amp;lt;/code&amp;gt; whenever the size changes, for example through [[API:WindowSetDimensions|WindowSetDimensions]].&lt;br /&gt;
* If an addon creates a global table with the same name as a window and gives it a &amp;lt;code&amp;gt;STATE&amp;lt;/code&amp;gt; field, &amp;lt;code&amp;gt;WindowGetDimensions&amp;lt;/code&amp;gt; returns whatever that table holds. Avoid using &amp;lt;code&amp;gt;STATE&amp;lt;/code&amp;gt; as a field name on window tables.&lt;br /&gt;
&lt;br /&gt;
== Errors ==&lt;br /&gt;
* &amp;lt;code&amp;gt;Error in function call &amp;#039;WindowGetDimensions&amp;#039;: Window %s does not exist&amp;lt;/code&amp;gt; (from &amp;lt;code&amp;gt;_WindowGetDimensions&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
Making a dialog cover the screen, from &amp;lt;code&amp;gt;easystem_dialogmanager/source/dialogmanager.lua&amp;lt;/code&amp;gt;. The root window&amp;#039;s size is divided by the interface scale because the dialog&amp;#039;s size is scaled when it is drawn:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
local x, y = WindowGetDimensions( &amp;quot;Root&amp;quot; )&lt;br /&gt;
x = x / InterfaceCore.GetScale()&lt;br /&gt;
y = y / InterfaceCore.GetScale()&lt;br /&gt;
WindowSetDimensions( &amp;quot;OneButtonDlg&amp;quot;..dlgIndex, x, y ) -- Set to the screen width and height&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[API:WindowSetDimensions|WindowSetDimensions]]&lt;br /&gt;
* [[API:WindowGetScale|WindowGetScale]]&lt;br /&gt;
* [[API:WindowGetScreenPosition|WindowGetScreenPosition]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>