<?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%3ACreateWindowFromTemplate</id>
	<title>API:CreateWindowFromTemplate - 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%3ACreateWindowFromTemplate"/>
	<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:CreateWindowFromTemplate&amp;action=history"/>
	<updated>2026-10-17T22:07:01Z</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:CreateWindowFromTemplate&amp;diff=30269&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:CreateWindowFromTemplate&amp;diff=30269&amp;oldid=prev"/>
		<updated>2026-10-16T19:41:53Z</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=Interface}}&lt;br /&gt;
Creates a new window from a window template and puts it under a parent window.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
created = CreateWindowFromTemplate(windowName, templateName, parentName)&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 new window. Child windows named &amp;lt;code&amp;gt;$parent...&amp;lt;/code&amp;gt; in the template get their names from it.&lt;br /&gt;
;templateName : &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; – Name of a window template defined in a loaded XML file.&lt;br /&gt;
;parentName : &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; – Name of an existing window that becomes the parent. Use &amp;lt;code&amp;gt;&amp;quot;Root&amp;quot;&amp;lt;/code&amp;gt; for a top-level window.&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
;created : &amp;lt;code&amp;gt;boolean&amp;lt;/code&amp;gt; – &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; if the window was created (or reused, see below), &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; otherwise.&lt;br /&gt;
&lt;br /&gt;
== Details ==&lt;br /&gt;
* The parent is checked first. If it does not exist, nothing is created and an error is logged.&lt;br /&gt;
* If a window called &amp;lt;code&amp;gt;windowName&amp;lt;/code&amp;gt; already exists, nothing is created and an error is logged. The exception is a window that is waiting for a deferred [[API:DestroyWindow|DestroyWindow]]: it is taken off the destroy list and kept as it is.&lt;br /&gt;
* If the template cannot be found or built, an error is logged and &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; is returned.&lt;br /&gt;
* When argument checking fails, nothing is returned.&lt;br /&gt;
&lt;br /&gt;
== Errors ==&lt;br /&gt;
These are written to the UI log; the call returns normally.&lt;br /&gt;
* &amp;lt;code&amp;gt;ERROR: Unable to create window: %s, parent window %s is invalid&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;ERROR: Unable to create window: %s, from template %s&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;ERROR: Window with this name already exists: %s&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
From &amp;lt;code&amp;gt;easystem_glyphdisplay/source/glyphdisplay.lua&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CreateWindowFromTemplate( glyphWindowName, &amp;quot;WorldMapGlyph&amp;quot;, self.windowName )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Creating a list row on demand, from &amp;lt;code&amp;gt;ea_tomeofknowledge/source/tomewindow_bestiary.lua&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CreateWindowFromTemplate( taskWindowName, &amp;quot;BestiarySpeciesTaskWindow&amp;quot;, parentWindow )&lt;br /&gt;
WindowAddAnchor( taskWindowName, &amp;quot;bottomleft&amp;quot;, anchorWindow, &amp;quot;topleft&amp;quot;, xOffset, yOffset )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[API:CreateWindow|CreateWindow]]&lt;br /&gt;
* [[API:DestroyWindow|DestroyWindow]]&lt;br /&gt;
* [[API:WindowSetParent|WindowSetParent]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>