Creating a frame

From Riftui Wiki

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.

Contents

Layout

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.

Context

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.

Frames

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.

Functions

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! --
textframe:SetText("Text!")
 
-- Move it to the top center of the game --
textframe:SetPoint("TOPCENTER", UIParent, "TOPCENTER")
Personal tools
Namespaces
Variants
Actions
Menu
Wiki
Toolbox