WoW:API CreateFrame: Difference between revisions
Jump to navigation
Jump to search
m
→Notes: stray comma
No edit summary |
m (→Notes: stray comma) |
||
Line 20: | Line 20: | ||
Result: displays the horde and alliance insignias in the middle of the screen. | Result: displays the horde and alliance insignias in the middle of the screen. | ||
local f = CreateFrame("Frame",nil,UIParent) | local f = CreateFrame("Frame",nil,UIParent) | ||
f:SetFrameStrata("BACKGROUND") | |||
f:SetWidth(128) -- Set these to whatever height/width is needed | |||
f:SetHeight(64) -- for your Texture | |||
local t = | local t = f:CreateTexture(nil,"BACKGROUND") | ||
t:SetTexture("Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Factions.blp") | |||
t:SetAllPoints(f) | |||
f.texture = t | f.texture = t | ||
f:SetPoint("CENTER",0,0) | |||
f:Show() | |||
== Notes == | == Notes == | ||
Line 43: | Line 43: | ||
** Creating frames on the fly for occasions when you don't know how many frames will be needed. | ** Creating frames on the fly for occasions when you don't know how many frames will be needed. | ||
** Creating infrequently used frames "on demand", for example: config dialogs, raid frames. | ** Creating infrequently used frames "on demand", for example: config dialogs, raid frames. | ||
* Never forget to unset the frames parent, if you want to get rid of a frame. I would suggest to hide the frame via frame:[[API_Region_Hide|Hide]]() and to use frame:[[API_Region_SetParent|SetParent]](nil) afterwards (this will remove the frame from its parents child list). If you just hide the frame without this additional step, | * Never forget to unset the frames parent, if you want to get rid of a frame. I would suggest to hide the frame via frame:[[API_Region_Hide|Hide]]() and to use frame:[[API_Region_SetParent|SetParent]](nil) afterwards (this will remove the frame from its parents child list). If you just hide the frame without this additional step, frames created afterwards will get a higher [[FrameLevel|framelevel]] then the hidden one. After a while you will get frames at maximum [[FrameLevel|framelevel]] which are likely to be drawn in a distorted way (false order caused by equal [[FrameLevel|framelevel]]). |