View Single Post
12-19-14, 11:20 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Lua Code:
  1. --create your frame
  2. --(note, you don't have to give your frame a global name, you can pass nil as the second argument instead)
  3. local frame = CreateFrame("Frame", "MyFrameName", UIParent)
  4.  
  5. --give your frame a size
  6. frame:SetSize(150, 150)
  7.  
  8. --give your frame something to look like
  9. frame:SetBackdrop({bgFile = "Path\\to\\texture"})
  10.  
  11. --give your frame a location on screen
  12. frame:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
  13.  
  14. --now make a fontstring for your text
  15. --(again, a global name is optional)
  16. local text = frame:CreateFontString("MyFrameText")
  17.  
  18. --give your text something to look like
  19. text:SetFont("Path\\to\\font", 12, "NORMAL")
  20.  
  21. --give your text some actual text
  22. text:SetText("This is my message to display.")

http://wowprogramming.com/docs/api/CreateFrame
http://wowprogramming.com/docs/widgets/Region/SetSize
http://wowprogramming.com/docs/widge...me/SetBackdrop
http://wowprogramming.com/docs/widgets/Region/SetPoint
http://wowprogramming.com/docs/widge...eateFontString
http://wowprogramming.com/docs/widge...stance/SetFont
http://wowprogramming.com/docs/widge...String/SetText

Also note that both CreateFrame and CreateFontString may use a template to define looks, font used, etc.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote