View Single Post
03-27-19, 01:32 AM   #1
Yaro
A Murloc Raider
Join Date: Feb 2013
Posts: 4
Question Beginner trouble with MessageFrame Boundaries

Code:
--------------------------------------------------------------------------------------------------
-- ADDON FRAME --
--------------------------------------------------------------------------------------------------
local addon = CreateFrame("Frame", "AddonTest", UIParent)
addon.width = 300
addon.height = 300
addon:SetSize(addon.width, addon.height)

local background_texture = addon:CreateTexture("BackgroundTexture", "BACKGROUND")
background_texture:SetWidth(500)
background_texture:SetHeight(500)
background_texture:SetTexture(0,0,1, .5)
background_texture:SetAllPoints(addon)

addon:SetPoint("CENTER", 0, 0)

--interactable
addon:EnableMouse(true)
addon:EnableMouseWheel(true)

--movable
addon:SetMovable(true)
addon:RegisterForDrag("LeftButton")
addon:SetScript("OnDragStart", addon.StartMoving)
addon:SetScript("OnDragStop", addon.StopMovingOrSizing)
--------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------
-- ADDON FRAME --> MESSAGE FRAME --
--------------------------------------------------------------------------------------------------
local messageFrame = CreateFrame("MessageFrame", nil, addon)
messageFrame:SetPoint("BOTTOMLEFT", 40, 40)
messageFrame:SetPoint("TOPRIGHT", -40, -40)
messageFrame:SetFontObject(GameFontNormal)
messageFrame:SetTextColor(1, 1, 1, 1)
messageFrame:SetJustifyH("LEFT")
messageFrame:SetFading(false)
addon.messageFrame = messageFrame

local mFrame_texture = messageFrame:CreateTexture("mFrameTexture", "BACKGROUND")
mFrame_texture:SetWidth(500)
mFrame_texture:SetHeight(500)
mFrame_texture:SetTexture(0,1,0, .5)
mFrame_texture:SetAllPoints(messageFrame)

messageFrame:AddMessage("HELLO!")
--------------------------------------------------------------------------------------------------
Resulting in:


Adding more messages ends up with:


I'm just starting out trying to throw some messages to a frame.
I added the texture to get a visual for just how big the MessageFrame was, and if I could somehow control it so that added messages wouldnt creep out of the frame.
I've tried to research this most of yesterday on my own, but I fear i lack the vocabulary for these things... I'm not even sure what the technical way would be to describe my problem, so I'm hoping one of you wizards can help me figure out what I've done wrong, and get the messages to start inside the frame.
  Reply With Quote