Undocking ChatFrame? - WoWInterface
Thread Tools Display Modes
07-05-21, 09:51 AM   #1
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 117
Undocking ChatFrame?


As often Shadowlands loose my chat windows configuration, I'm trying to write a little LUA script to rebuild my chat frames.
I'm creating a new chat frame, say for example "Guild" and I would like this new chat frame to be undocked. I have the following code:
local frame = FCF_OpenNewWindow("Guild")

frame:SetPoint("TOPLEFT", ChatFrame1, "TOPRIGHT", 60, 0)--***
FCF_UpdateButtonSide(frame)-- ???
The chat frame is well created at the right of the ChatFrame1, but its tab stays docked.

Another question: is there a way to reset all chats without the confirmation alert showned by FCF_ResetAllWindows()?

Thank you.
  Reply With Quote
07-05-21, 10:35 AM   #2
I did that?
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,439
is there a way to reset all chats without the confirmation...
For the tab you could try something like
Lua Code:
  1. local tab = _G[frame:GetName().."Tab"]
  2. tab:ClearAllPoints()
  3. tab:SetPoint("point", frame, "topoint", x, y)

But I'm not sure if the tab manager might not try to re-aquire it at some point so...
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
07-05-21, 12:12 PM   #3
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 117
Seems to work (though I was afraid it was just a cosmetic trick).
Thanks Fizzlemizz.

Still another question:
I'm unable to check with LUA the following checked channels (sorry, my UI is french localized):

I tried ChatFrame_AddMessageGroup(frame, value) with following values

Last edited by Zax : 07-05-21 at 12:20 PM.
  Reply With Quote
07-05-21, 08:59 PM   #4
A Molten Giant
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 578
You need to use the ChatTypeGroups, which are the table keys that include the message types themselves.


If you want to add a single message type, use ChatFrame_AddSingleMessageType. There is no remove single message type function.

As for your code that enforces a chatframe, here's what I use if you want to pick it apart:

Standard docked creation:

Lua Code:
  1. -- 1 is the "default" frame where print() goes
  2. -- 2 is combat log
  3. -- 3 has been taken by the new Voice Text-to-Speech functionality
  4. -- you can still technically use 3, but the tab text is going to be purple
  5. local frame=ChatFrame4
  6. _G[frame:GetName().."Tab"].sizePadding=0
  7. FCF_SetWindowName(frame,"TAB NAME")
  8. FCF_SetWindowColor(frame,0,0,0)
  9. FCF_SetWindowAlpha(frame,0)
  10. FCF_UnDockFrame(frame)
  11. frame:SetClampRectInsets(0,0,0,0)
  12. PixelUtil.SetSize(frame,400,80)
  13. frame:ClearAllPoints()
  14. frame:SetPoint("BOTTOMLEFT",
  15.     PixelUtil.GetNearestPixelSize(3,frame:GetEffectiveScale()),
  16.     PixelUtil.GetNearestPixelSize(252,frame:GetEffectiveScale())
  17. )
  18. frame:SetUserPlaced(true)
  19. FCF_SavePositionAndDimensions(frame)
  20. FCF_DockFrame(frame,frame:GetID())
  21. frame.isStaticDocked=true
  22. FCF_SetUninteractable(frame,false)
  23. frame:Show()
  24. SetChatWindowShown(frame:GetID(),true)

Standard undocked creation:

Lua Code:
  1. local frame=ChatFrame5
  2. _G[frame:GetName().."Tab"].sizePadding=0
  3. FCF_SetWindowName(frame,"TAB NAME")
  4. FCF_SetWindowColor(frame,0,0,0)
  5. FCF_SetWindowAlpha(frame,0)
  6. FCF_UnDockFrame(frame)
  7. frame:SetClampRectInsets(0,0,0,0)
  8. PixelUtil.SetSize(frame,400,80)
  9. frame:ClearAllPoints()
  10. frame:SetPoint("BOTTOMLEFT",
  11.     PixelUtil.GetNearestPixelSize(3,frame:GetEffectiveScale()),
  12.     PixelUtil.GetNearestPixelSize(86,frame:GetEffectiveScale())
  13. )
  14. frame:SetUserPlaced(true)
  15. FCF_SavePositionAndDimensions(frame)
  16. FCF_SetLocked(frame,true)
  17. FCF_SetUninteractable(frame,false)
  18. frame:Show()
  19. SetChatWindowShown(frame:GetID(),true)

Along with some other code, including my own border and background, in tandem with Prat, this is what my chat looks like:

Some notes:
  • SetClampRectInsets allows the chat to sit right on the edge of the screen. In the screenshot, that is the lower left of my screen. The chatframes are exactly one pixel away from the edge.
  • PixelUtil functions automatically figure out the math behind pixel perfect sizing and placement, since my UI scale isn't 1.
  • The undock usage right before docking for the docked creation was necessary to prevent some weirdness, but I don't remember how or what since I've been using this setup for several expansions.
  • The rest of the functions all copy what the UI does when setting up chat frames, ensuring everything is covered and the frames are accepted.

Last edited by Kanegasi : 07-06-21 at 06:20 AM. Reason: non-album imgur link
  Reply With Quote
07-06-21, 05:38 AM   #5
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 117
Great ! Thank you very much Kanegasi

After some quick tests, FCF_UnDockFrame(frame) doesn't seem to be called for a docked frame.

Concerning "Blizzard Alerts" channel, its real name is in fact "BN_INLINE_TOAST_ALERT".
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Undocking ChatFrame?

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