Lua - Я создал рамку в Lua, но не знаю, как вставить в нее текст? - PullRequest
0 голосов
/ 23 декабря 2011
local MyAddon = CreateFrame("frame","MyAddonFrame")
MyAddon:SetBackdrop({
      bgFile="Interface\\DialogFrame\\UI-DialogBox-Background", 
      edgeFile="Interface\\DialogFrame\\UI-DialogBox-Border", 
      tile=1, tileSize=32, edgeSize=32, 
      insets={left=11, right=12, top=12, bottom=11}
})
MyAddon:SetWidth(220)
MyAddon:SetHeight(400)
MyAddon:SetPoint("CENTER",UIParent)
MyAddon:EnableMouse(true)
MyAddon:SetMovable(true)
MyAddon:RegisterForDrag("LeftButton")
MyAddon:SetScript("OnDragStart", function(self) self:StartMoving() end)
MyAddon:SetScript("OnDragStart", function(self) self:StartMoving() end)
MyAddon:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
MyAddon:SetFrameStrata("FULLSCREEN_DIALOG")



MyAddon:RegisterEvent("PLAYER_ENTERING_WORLD");
local function eventHandler(self, event, ...)
 print("Hello World! Hello " .. event);
end
MyAddon:SetScript("OnEvent", eventHandler);

Я кодировал фрейм, который будет создан в Lua, и просто хочу вставить «Hello World», чтобы текст был частью фрейма.

Любой совет?

1 Ответ

2 голосов
/ 28 января 2012

Полагаю, вам нужна функция CreateFontString:

local helloFS = MyAddon:CreateFontString(nil, "OVERLAY", "GameFontNormal")
helloFS:SetPoint("CENTER")
helloFS:SetText("Hello World!")
...