Virtual XML template

From Warcraft Wiki
Jump to navigation Jump to search


Virtual XML templates[1] (or deferred nodes[2]) extend the Widget API by allowing widgets to inherit properties.

<Frame name="MyFrameTemplate" virtual="true" />
<Frame inherits="MyFrameTemplate" />

CreateFrame("Frame", nil, nil, "MyFrameTemplate")

Usage

  • Add virtual="true" (and a name) in XML to any kind of <LayoutFrame>, <Animation> or <AnimationGroup>.
  • New widgets may inherit templates using a comma-delimited list of template names:
    • The inherits="" attribute in XML.
    • The fourth argument in CreateFrame().
  • FrameXML provides numerous templates that AddOns may use, including:

Details

  • Templates do not reside in the global environment (_G) during runtime; they exist in a separate state.[3]
  • Reusing the same name on two virtual templates will throw a warning in Logs/FrameXML.log and in-game.[2]

Patch changes

See also

References