Quantcast
Attach chat editbox to a frame other than DEFAULT_CHAT_FRAME - WoWInterface
Thread Tools Display Modes
11-12-17, 12:33 PM   #1
AnrDaemon
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 156
Attach chat editbox to a frame other than DEFAULT_CHAT_FRAME

First, a little preamble.
Ever since the days of Lineage2, I'm used to less-than-important-but-still-useful messages to be redirected to a separate, always visible chat frame.
This is how it looks in today's WoW: https://prnt.sc/h9jg76
But here's the problem.
All addons send their output to DEFAULT_CHAT_FRAME naively assuming that it is the frame people watch the most.
There's a simple solution to output data to the desired frame, but when I do something like
Lua Code:
  1. if ChatFrame6Tab then DEFAULT_CHAT_FRAME = ChatFrame6 end
the editbox is also become attached to that frame.
Is there an easy way to move editbox to a more appropriate place?

Last edited by AnrDaemon : 11-12-17 at 12:35 PM.
  Reply With Quote
11-12-17, 03:42 PM   #2
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 575
The addon Prat can do this.

Here's a screenshot below of where the setting is. You may need to enable "Editbox" in the Module Control tab, where I put the question mark. Click the screenshot for full size.



If you don't want a full chat addon just for this function, you can disable everything but the Editbox in the Module Control and the Editbox will be the only thing it does.

Last edited by Kanegasi : 11-12-17 at 03:45 PM.
  Reply With Quote
11-12-17, 08:45 PM   #3
AnrDaemon
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 156
Chatter does the same, in the same way (read: ugly half-[censored] [censored])
I'm looking for a more clean way to do it, than what these both addons are doing.
  Reply With Quote
11-13-17, 10:02 AM   #4
Tim
A Frostmaul Preserver
 
Tim's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 294
Code:
-- function to reposition editbox

local function RepositionEditBox(self)

   if not self then return end

   local name = self:GetName()
   local box = _G[name.."EditBox"]
   box:ClearAllPoints()
   box:SetPoint("BOTTOM", self, "TOP", 0, 22)
   box:SetPoint("LEFT", self, -5, 0)
   box:SetPoint("RIGHT", self, 10, 0)

end


-- code to initiate the repositioning

for i = 1, NUM_CHAT_WINDOWS do
   RepositionEditBox(_G["ChatFrame"..i])
end

To change the positioning of the box you will want to edit the 1st SetPoint.

BOTTOM = anchor point (so in that line you're anchoring the bottom of the editbox)
self = the chatframe (if you want to anchor it to a different parent then you will need to change all 3 setpoints)
TOP = relative point (basically where you want to position said object in reference to "self" or the parent)
0 = x coords
22 = y coords
  Reply With Quote
11-13-17, 01:47 PM   #5
AnrDaemon
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 156
I'm familiar with frame positioning basics.
Thanks for an example, will see how to apply it to my case!
  Reply With Quote
11-13-17, 04:28 PM   #6
AnrDaemon
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 156
A slightly relevant question: What is the earliest event where chat frames are available?
I'd like to hook a few functions there once.
Changing default chat frame in PLAYER_ENTERING_WORLD doesn't work desirable for my purposes, it breaks a few functions of Chatter that I'd like to keep functional. Such as edit box history.
  Reply With Quote
11-13-17, 04:57 PM   #7
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
You could try UPDATE_CHAT_WINDOWS, see if that does what you want.

If you need it to only fire once, you can unregister the event from within your script. Not sure how often UPDATE_CHAT_WINDOWS fires. All I did was make it print "hi" in chatbox and that showed up before my guild MotD even.

Last edited by Ammako : 11-13-17 at 05:00 PM.
  Reply With Quote
11-21-17, 05:50 PM   #8
AnrDaemon
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 156
Thanks. A number of experiments made me think that I should look for different ways to do what I want to do.
Since this is quickly drifting out of the topic title, I'll submit a new topic once I have a better understanding of my needs.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Attach chat editbox to a frame other than DEFAULT_CHAT_FRAME

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off