View Single Post
10-23-15, 09:41 PM   #14
Gethe
RealUI Developer
 
Gethe's Avatar
Premium Member
Featured
Join Date: Sep 2008
Posts: 942
On the subject of functions in XML, in 6.1 Blizzard added a "mixin" attribute for frames (note: not sure if it's only for frames). This adds the functions from the referenced global table into the attributed frame, allowing you to access those functions (and maybe other data, I have not tested this) via self in both XML and Lua.

Blizzard uses this mostly in the Garrison UI (since 6.2), though it was first used in the Heirloom Collection (in 6.1). They create the global table "GarrisonFollowerList" in Blizzard_GarrisonSharedTemplates.lua, and is used as a mixin for many frames. You can see Blizzard_GarrisonRecruiterUI.xml where they use the OnShow and OnHide methods from the mixin table within the applicable scripts.

Many addons create at least one global to house various bits of data, so this same global can easily be used as a mixin for XML created frames. That said, debugging would still be much easier in Lua so there probably won't be many authors switching to use the new attribute; however, it could be very useful for use in eg. templates where XML is required.
__________________
Knowledge = Power; Be OP


Last edited by Gethe : 10-23-15 at 09:43 PM.
  Reply With Quote