Creating a frame

From Riftui Wiki

Revision as of 23:06, 8 May 2014 by Spwof (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Frames are what enable an addon to be seen visually. It enables a developer to render text, textures and display animations.



Each addon is presented with a layout and is accessible through the UIParent variable. Layouts are not modifiable and are handled by the main API. However, an addon may attach elements to it and get information about it. For detailed information, see the Layout page.


A context is the foundation frame to an addon and is the only frame attached to UIParent. For an example, if the layout was Photoshop, the context would be the canvas or file. It is essentially the same as a normal frame in a sense that it has the same exact functionality, however, the way the API constructs a context is what makes it different. For more information, see the Context page.


A frame is the basic component for rendering information and elements. While an addon's layout cannot be modified, a frame lets an addon manipulate it. Currently there are 4 types of frame: frame, text, texture, and mask.


There are currently two main functions for Frame Creation:

Frame Creation Example

-- First, create a context --
local context = UI.CreateContext("SampleContext")
-- Create a Text frame --
local textframe = UI.CreateFrame("Text", "SampleTextFrame", context)
-- Make it display Text! --
-- Move it to the top center of the game --
textframe:SetPoint("TOPCENTER", UIParent, "TOPCENTER")
Personal tools