API:CreateWindow
From RoR Wiki
UI Lua API · Interface functions
Version: WAR 1.4.8
Creates a top-level window from the window definition of the same name.
CreateWindow(windowName, show)
Arguments
- windowName
string– Name of a window defined in a loaded XML file. The new window gets the same name.- show
boolean–trueto show the window at once,falseto create it hidden.
Returns
Nothing.
Details
- The window is created as a child of the root window. To create a window with a different name or under another parent, use CreateWindowFromTemplate.
- If a window with this name already exists, it is not created again 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, and its showing flag is set to
show. - If no definition with this name exists, the error
ERROR: Unable to create window: %sis logged. showmust be a real boolean. Passingnilor a number raises an Invalid Parameters error.- The function needs at least two arguments and only reads the last two.
- Use DoesWindowExist to check first if the window may already exist.
Errors
These are written to the UI log; the call returns normally.
ERROR: Unable to create window: %sERROR: Window with this name already exists: %s
Example
From easystem_dialogmanager/source/dialogmanager.lua:
CreateWindow( "OneButtonDlg"..dlg, false )
