View Single Post
07-05-21, 08:59 PM   #4
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
You need to use the ChatTypeGroups, which are the table keys that include the message types themselves.

https://www.townlong-yak.com/framexm...tFrame.lua#131

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