Things I learned doing by trying, examining, searching the internet, looking at someone else's code. Probably not the real terms or explanations but something to get you on your way. (Still a lua noob in many ways). this is not complete in any way, hoping to update it once in a while.
CREATE A PANEL:
the creation of a new panel starts like this:
Code: Select all
local YourOwnPanel = CreateFrame("Frame", "Thisismynewpanel", UIParent)
Code: Select all
local YourOwnPanel = CreateFrame("Frame", "YourOwnPanel", self)
local = needed so it's used locally, in this code/file only.
YourOwnPanel = the name you give your panel in the code, case sensitive!
CreateFrame = function to create the Frame
Frame = type of Frame
Thisismynewpanel = unique name so it can be found, you can also use the same name you used at the beginning of the line.
UIParent = the panel or frame that your new panel is a child of. Which frame it follows it's behavior from.
self = it has no parent, nothing to stick to or follow.
DIMENSIONS:
Ways to set the size of a panel:
Code: Select all
YourOwnPanel:Size(200, 40)
YourOwnPanel:Width(200)
YourOwnPanel:Height(40)
YourOwnPanel:Size(200+2, 40-3)
YourOwnPanel:Width(200+2)
YourOwnPanel:Height(40)
YourOwnPanel:Height(SomePanel:GetHeight())
YourOwnPanel:Height(SomePanel:GetWidth())
YourOwnPanel:Height(SomePanel:GetHeight() +2)
YourOwnPanel:Height(SomePanel:GetWidth() -3)
YourOwnPanel:Height(SomePanel:GetWidth() *2)
YourOwnPanel:Height(SomePanel:GetWidth() /3)
POSITIONING:
The position of your panel, relative to something else. Read it as:
Code: Select all
YourOwnPanel:Point("TOPLEFT", UIParent, "TOPLEFT", 6, -14)
I want to anchor YourOwnPanel's TOPLEFT to UIParent's TOPLEFT, but I want it 6 pixels to the right and 14 pixels lower.
anchor points you can use:
"TOPLEFT"
"LEFT"
"BOTTOMLEFT"
"BOTTOM"
"BOTTOMRIGHT"
"RIGHT"
"TOPRIGHT"
The first number is the X-Axis, Left (-any number, negative) and Right (+any number, positive)
The second number is the Y-Axis, Up (+any number, positive) and Down (+any number, negative)
ALPHA SETTINGS:
You can make a panel less or more solid by entering a number between 0 (opaque) and 1 (solid)
Code: Select all
YourOwnPanel:SetAlpha(1)
YourOwnPanel:SetAlpha(OtherPanel:GetAlpha())
FRAME LEVEL:
the level a frame has, tells if a frame is in front or behind another frame on the same strata/layer.
Code: Select all
YourOwnPanel:SetFrameLevel(2)
YourOwnPanel:SetFrameLevel(OtherPanel:GetFrameLevel() +1)
FRAME STRATA:
a kind of layer in which your panel is placed, so it will show up in front of other elements on lower layers.
Code: Select all
YourOwnPanel:SetFrameStrata("BACKGROUND")
BACKGROUND - Used by default for static UI elements such as the PlayerFrame and Minimap
LOW - Used by default for lower-priority UI elements such as the party member and target frames
MEDIUM - Default frame strata for general usage
HIGH - Used by default for higher-priority UI elements such as the Calendar and Loot frames
DIALOG - Used by default for alerts and other dialog boxes which should appear over nearly all other UI elements
FULLSCREEN - Used by default for full-screen windows such as the World Map
FULLSCREEN_DIALOG - Used by default for alerts or dialog boxes which should appear even when a full-screen window is visible
TOOLTIP - Used for mouse cursor tooltips, ensuring they appear over all other UI elements
TEMPLATES:
SHADOW:
Code: Select all
YourOwnPanel:CreateShadow("Default")
HIDING WHILE IN COMBAT/VISIBILITY OPTIONS AND BEHAVIOR:
Code: Select all
RegisterStateDriver(YourOwnPanel, "visibility", "[combat] hide; show")
ADDING COLOR:
ADDING TEXT:
ADDING TEXTURES/IMAGES:
MOVABLE:
SHOW/HIDE:
Code: Select all
YourOwnPanel:Show()
YourOwnPanel:Hide()
MOUSEOVER:
HOOKING IT TO THE FUNCTIONS TUKUI ALREADY CREATED:
Code: Select all
local T, C, L = Tukui:unpack()
local function Enable()
end
hooksecurefunc(Panels, "Enable", Enable)
COMPLETE:
For adding a panel in your edit based on Tukui and hooking it to Tukui's functions:
Code: Select all
local T, C, L = Tukui:unpack()
local function Enable()
local YourOwnPanel = CreateFrame("Frame", "Thisismynewpanel", UIParent)
YourOwnPanel:SetTemplate()
YourOwnPanel:Point("CENTER", UIParent, "CENTER", 6, -14)
YourOwnPanel:Width(200)
YourOwnPanel:Height(40)
YourOwnPanel:SetAlpha(0.6)
YourOwnPanel:SetFrameStrata("BACKGROUND")
YourOwnPanel:SetFrameLevel(2)
YourOwnPanel:CreateShadow("Default")
RegisterStateDriver(YourOwnPanel, "visibility", "[combat] hide; show")
local OtherPanel = CreateFrame("Frame", "OtherPanel", Thisismynewpanel)
OtherPanel:SetTemplate()
OtherPanel:Point("TOPLEFT", Thisismynewpanel, "BOTTOMRIGHT", 6, -14)
OtherPanel:Width(YourOwnPanel:GetWidth()/2)
OtherPanel:Height(YourOwnPanel:GetHeight()/2)
OtherPanel:SetAlpha(0.3)
OtherPanel:SetFrameStrata("BACKGROUND")
OtherPanel:SetFrameLevel(YourOwnPanel:GetFrameLevel()+1)
OtherPanel:CreateShadow("Default")
RegisterStateDriver(OtherPanel, "visibility", "[combat] hide; show")
end
hooksecurefunc(Panels, "Enable", Enable)