I didn’t have anything to hand so I cobbled this from bits without really looking at it so it could probably be cleaned up but… It should work if you post text to it like posting a chat message or for scrolling as you type.
To get it started:
/ft some text
local frame = nil
local function ScrollText(self, x, y, w, h)
local cursorHeight = h
local cursorOffset = -y
local scrollFrame = self:GetParent()
local scroll = scrollFrame:GetVerticalScroll()
local range = scrollFrame:GetVerticalScrollRange()
local vs = scrollFrame:GetVerticalScroll()
local sh = scrollFrame:GetHeight()
if vs + y > 0 or 0 > vs + y - h + sh then
while ( (cursorOffset + cursorHeight) > (scroll + h) and scroll < range ) do
scroll = (scroll + (h / 2))
if ( scroll > range ) then
scroll = range
end
end
scrollFrame:SetVerticalScroll(scroll)
end
end
local function CreateTheFrame()
frame = CreateFrame("Button", "FizzleEditListTest", UIParent)
frame:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background", edgeFile="Interface/Tooltips/UI-Tooltip-Border", tile = true, tileSize = 8, insets = {left = 8, right = 8, top = 8, bottom = 8},})
frame:SetBackdropColor(0, 0, 0)
frame:SetPoint("RIGHT", -12)
frame:SetSize(300, 400)
frame.SF = CreateFrame("ScrollFrame", "$parent_SF", frame, "UIPanelScrollFrameTemplate")
frame.SF:SetPoint("TOPLEFT", frame, 12, -30)
frame.SF:SetPoint("BOTTOMRIGHT", frame, -30, 10)
frame.Text = CreateFrame("EditBox", "$parent_EB", frame)
frame.Text.cursorPos = 0
frame.Text:SetMultiLine(true)
frame.Text:SetSize(180, 170)
frame.Text:SetPoint("TOPLEFT", frame.SF)
frame.Text:SetPoint("BOTTOMRIGHT", frame.SF)
frame.Text:SetMaxLetters(99999)
frame.Text:SetFontObject(GameFontNormal)
frame.Text:SetAutoFocus(false)
frame.Text:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
frame.Text:SetScript("OnCursorChanged", ScrollText)
frame.SF:SetScrollChild(frame.Text)
frame.Close = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
frame.Close:SetSize(24, 24)
frame.Close:SetPoint("TOPRIGHT", -8, -8)
frame.Close:SetText("X")
frame.Close:SetScript("OnClick", function(self) self:GetParent():Hide() end)
frame.Clear = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
frame.Clear:SetSize(24, 24)
frame.Clear:SetPoint("RIGHT", frame.Close, "LEFT", -1)
frame.Clear:SetText("C")
frame.Clear:SetScript("OnClick", function(self) self:GetParent().Text:ClearFocus() end)
frame:RegisterForClicks("LeftButtonDown", "LeftButtonUp", "RightButtonUp")
frame:RegisterForDrag("LeftButton")
frame:SetMovable(true)
frame:SetScript("OnDragStart", function(self) self:StartMoving() end)
frame:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() ValidateFramePosition(self) end)
end
local Counter = 0
local function AddMessage(msg)
if not frame then
CreateTheFrame()
end
Counter = Counter + 1
frame.Text:SetFocus()
frame.Text:SetText(frame.Text:GetText() .. "\n" .. Counter .. " - " .. msg)
if not frame:IsShown() then
frame:Show()
end
end
SLASH_FIZZLETEXT1 = "/ft"
SlashCmdList["FIZZLETEXT"] = function(msg)
if msg ~= "" then
AddMessage(msg)
end
end