View Single Post
09-16-19, 05:17 PM   #4
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Originally Posted by tirafesi View Post
Yeah, that's how I did it. But I was wondering if there was a more compact way of doing this without having to write 8 lines of code just to show one sentence ;-;

Code:
local msgFrame = CreateFrame("FRAME", nil, UIParent)
msgFrame:SetWidth(1)
msgFrame:SetHeight(1)
msgFrame:SetPoint("CENTER")
msgFrame:SetFrameStrata("TOOLTIP")
msgFrame.text = msgFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
msgFrame.text:SetPoint("CENTER")
msgFrame.text:SetText("Hello World")
If you just want to quickly display some info you could use:
Code:
message("Hello World")
or you could remove creating a separate frame and just create a FontString from UIParent:
Code:
local text = UIParent:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
text:SetPoint("CENTER")
text:SetText("Hello World")
  Reply With Quote