Thread Tools Display Modes
12/28/14, 10:18 PM   #1
Balver
 
Balver's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 39
Hide chat in menu

I'm looking for an addon that automatically hides the chat window when I open a menu or use the bank or a crafting station.
  Reply With Quote
12/29/14, 07:35 AM   #2
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 1,019
could add this into pChat .. will have a look on it.
  Reply With Quote
01/03/15, 02:56 PM   #3
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,000
Maybe this helps. Taken from the gamemenu scene source code "here"

Lua Code:
  1. local wasChatMaximized
  2. local function OnShow(gameMenu)
  3.     RebuildTree(gameMenu)
  4.     wasChatMaximized = not CHAT_SYSTEM:IsMinimized()
  5.     if wasChatMaximized then
  6.         CHAT_SYSTEM:Minimize()
  7.     end
  8. end
  9. local function OnHide(gameMenu)
  10.     if wasChatMaximized and CHAT_SYSTEM:IsMinimized()then
  11.         CHAT_SYSTEM:Maximize()
  12.     end
  13.     wasChatMaximized = nil
  14. end

Too bad it is local :-( But maybe you can use this code of CHAT_SYSTEM to simply hide (Minimize) /show (Maximize) the chat.
  Reply With Quote
01/03/15, 04:05 PM   #4
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by Baertram View Post
Maybe this helps. Taken from the gamemenu scene source code "here"

Lua Code:
  1. local wasChatMaximized
  2. local function OnShow(gameMenu)
  3.     RebuildTree(gameMenu)
  4.     wasChatMaximized = not CHAT_SYSTEM:IsMinimized()
  5.     if wasChatMaximized then
  6.         CHAT_SYSTEM:Minimize()
  7.     end
  8. end
  9. local function OnHide(gameMenu)
  10.     if wasChatMaximized and CHAT_SYSTEM:IsMinimized()then
  11.         CHAT_SYSTEM:Maximize()
  12.     end
  13.     wasChatMaximized = nil
  14. end

Too bad it is local :-( But maybe you can use this code of CHAT_SYSTEM to simply hide (Minimize) /show (Maximize) the chat.
It is local, but if you take a look how those functions are used:

xml Code:
  1. <GuiXml>
  2.     <Controls>
  3.         <TopLevelControl name="ZO_GameMenu_InGame" inherits="ZO_GameMenu_Template" hidden="true">
  4.             <OnInitialized>
  5.                 ZO_GameMenu_InGame_Initialize(self)
  6.             </OnInitialized>
  7.         </TopLevelControl>
  8.     </Controls>
  9. </GuiXml>

Lua Code:
  1. function ZO_GameMenu_InGame_Initialize(self)
  2.     local GAME_MENU_INGAME = ZO_GameMenu_Initialize(self, OnShow, OnHide)
  3.  
  4.     --some other code
  5. end

Lua Code:
  1. function ZO_GameMenu_Initialize(control, onShowFunction, onHideFunction)
  2.     local gameMenu = ZO_GameMenuManager:New(control)
  3.     control.OnShow = onShowFunction
  4.     control.OnHide = onHideFunction
  5.     control.gameMenu = gameMenu
  6.     return gameMenu
  7. end

You can see, that there is a global reference to those functions:
Code:
ZO_GameMenu_InGame:OnShow()
ZO_GameMenu_InGame:OnHide()

Last edited by Garkin : 01/03/15 at 04:08 PM.
  Reply With Quote
01/03/15, 04:29 PM   #5
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,000
Yes, I saw this before, thanks Garkin.

The OnHide function should be fine.
But the OnShow function of the "game menu ingame" in total isn't the thing needed here as it would also rebuild the game menu tree.

I think you could simply use the CHAT_SYSTEM:Maximize() and CHAT_SYSTEM:Minimize() functions here to show/hide the chat as a bank/crafting station/etc. scene gets to the state OnShown e.g.
  Reply With Quote
01/03/15, 04:37 PM   #6
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 1,019
I'm already working on this. I prehook SCENE_MANAGER:SetState() and use CHAT_SYSTEM:Minimize() and :Maximize() for my part.

Just need to disable it at 1st state (when addon loads) and check if scene manager is on "hudui" or not.
  Reply With Quote
01/03/15, 05:24 PM   #7
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by Ayantir View Post
I'm already working on this. I prehook SCENE_MANAGER:SetState() and use CHAT_SYSTEM:Minimize() and :Maximize() for my part.

Just need to disable it at 1st state (when addon loads) and check if scene manager is on "hudui" or not.
Usually everything, what you want to do when scene is showing or hiding, is done by registering to StateChange callback, something like:
Lua Code:
  1. local function OnStateChange(oldState, newState)
  2.     if newState == SCENE_SHOWING then
  3.         CHAT_SYSTEM:Minimize()
  4.     elseif newState == SCENE_HIDDEN then
  5.         CHAT_SYSTEM:Maximize()
  6.     end
  7. end
  8.  
  9. local scene = SCENE_MANAGER:GetScene("bank")
  10. scene:RegisterCallback("StateChange", OnStateChange)
But if it works, do it as you like.
  Reply With Quote
01/04/15, 04:24 PM   #8
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 1,019
Originally Posted by Garkin View Post
Usually everything, what you want to do when scene is showing or hiding, is done by registering to StateChange callback, something like:
Lua Code:
  1. local function OnStateChange(oldState, newState)
  2.     if newState == SCENE_SHOWING then
  3.         CHAT_SYSTEM:Minimize()
  4.     elseif newState == SCENE_HIDDEN then
  5.         CHAT_SYSTEM:Maximize()
  6.     end
  7. end
  8.  
  9. local scene = SCENE_MANAGER:GetScene("bank")
  10. scene:RegisterCallback("StateChange", OnStateChange)
But if it works, do it as you like.

SetState triggers too often and SetBaseScene get a little bug when prehooking.

So I used your method :

Lua Code:
  1. function pChat.onSceneStateChange(oldState, newState)
  2.  
  3.     if pChat.opts.chatMinimizedInMenus then
  4.         if newState == SCENE_HIDDEN then
  5.             CHAT_SYSTEM:Minimize()
  6.         end
  7.     end
  8.  
  9.     if pChat.opts.chatMaximizedAfterMenus then
  10.         if newState == SCENE_SHOWING then
  11.             CHAT_SYSTEM:Maximize()
  12.         end
  13.     end
  14.    
  15. end
  16.  
  17. -- RegisterCallback for Maximize/Minimize chat when entering/leaving scenes
  18. -- "hud" is base scene (with "hudui") -- This declaration has to be set AFTER pChat.onSceneStateChange declaration
  19. pChat.hud = SCENE_MANAGER:GetScene("hud")
  20. pChat.hud:RegisterCallback("StateChange", pChat.onSceneStateChange)

Thank you

Anyway, option asked added in pChat 1.17

Last edited by Ayantir : 01/04/15 at 04:30 PM.
  Reply With Quote
01/05/15, 02:53 AM   #9
Balver
 
Balver's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 39
Thanks for adding this .
  Reply With Quote

ESOUI » AddOns » AddOn Search/Requests » Hide chat in menu


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