Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
WoW
Talk
English
Views
Read
Edit
History
More
Search
Navigation
Home
Random page
Help using wiki
Editions
for WoW
for WildStar
for Solar2D
Documentation
for WoW
for WildStar
Reference
WoW
⦁ FrameXML
⦁ AddOns
⦁ API
⦁ WoW Lua
WildStar
⦁ AddOns
⦁ API
⦁ WildStar Lua
Engine
Tools
What links here
Related changes
Special pages
Page information
Site
Recent Changes
Editing
WoW:UI XML tutorial
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Naming Widgets == Every widget element may have the '''name''' attribute. If an element has a name, it causes a global Lua variable to be created with that name. This variable can then be used to call API methods on that widget. (See [[Widget API]] for a list of methods available for the different UI widgets.) Note that global variables are truly global across the entire UI, meaning that every name must be unique across all XML files. Here is an example. Let's say in your XML file you have a section like this: <Frame name="MyAddon_Frame"> .. <Frames> <Button name="MyAddon_Button"> .. </Button> </Frames> </Frame> In any Lua code then you can use the variable MyAddon_Frame to refer to the frame and MyAddon_Button to refer to the button. For example, to show the frame, call MyAddon_Frame:[[API LayoutFrame Show|Show()]]. Or to disable the button, call MyAddon_Button:[[API Button Disable|Disable]](). When defining the name of a widget, the special string '''$parent''' may be used. This will take on the name of whatever the parent of that widget is. For example: <Frame name="MyAddon_Frame"> .. <Frames> <Button name="$parent_Button"> .. </Button> </Frames> </Frame> This results in two global Lua variables: MyAddon_Frame and MyAddon_Frame_Button.
Summary:
Please note that all contributions to AddOn Studio are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
AddOn Studio Wiki:Copyrights
for details).
Submissions must be written by you, or copied from a public domain or similar free resource (see
AddOn Studio Wiki:Copyrights
for details).
Cancel
Editing help
(opens in new window)