WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Attach chat editbox to a frame other than DEFAULT_CHAT_FRAME (https://www.wowinterface.com/forums/showthread.php?t=55843)

AnrDaemon 11-12-17 12:33 PM

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?

Kanegasi 11-12-17 03:42 PM

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.

AnrDaemon 11-12-17 08:45 PM

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.

Tim 11-13-17 10:02 AM

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

AnrDaemon 11-13-17 01:47 PM

I'm familiar with frame positioning basics.
Thanks for an example, will see how to apply it to my case!

AnrDaemon 11-13-17 04:28 PM

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.

Ammako 11-13-17 04:57 PM

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.

AnrDaemon 11-21-17 05:50 PM

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.


All times are GMT -6. The time now is 06:54 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI