API:CreateWindowFromTemplate
From RoR Wiki
UI Lua API · Interface functions
Version: WAR 1.4.8
Creates a new window from a window template and puts it under a parent window.
created = CreateWindowFromTemplate(windowName, templateName, parentName)
Arguments
- windowName
string– Name of the new window. Child windows named$parent...in the template get their names from it.- templateName
string– Name of a window template defined in a loaded XML file.- parentName
string– Name of an existing window that becomes the parent. Use"Root"for a top-level window.
Returns
- created
boolean–trueif the window was created (or reused, see below),falseotherwise.
Details
- The parent is checked first. If it does not exist, nothing is created and an error is logged.
- If a window called
windowNamealready exists, nothing is created and an error is logged. The exception is a window that is waiting for a deferred DestroyWindow: it is taken off the destroy list and kept as it is. - If the template cannot be found or built, an error is logged and
falseis returned. - When argument checking fails, nothing is returned.
Errors
These are written to the UI log; the call returns normally.
ERROR: Unable to create window: %s, parent window %s is invalidERROR: Unable to create window: %s, from template %sERROR: Window with this name already exists: %s
Example
From easystem_glyphdisplay/source/glyphdisplay.lua:
CreateWindowFromTemplate( glyphWindowName, "WorldMapGlyph", self.windowName )
Creating a list row on demand, from ea_tomeofknowledge/source/tomewindow_bestiary.lua:
CreateWindowFromTemplate( taskWindowName, "BestiarySpeciesTaskWindow", parentWindow ) WindowAddAnchor( taskWindowName, "bottomleft", anchorWindow, "topleft", xOffset, yOffset )
