Thread Tools Display Modes
02-12-08, 02:49 AM   #1
Falcon213
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Mar 2007
Posts: 18
Hiding chat frames?

I'm trying to hide the chat frame using a macro, and tried this:
Code:
/script SetChatWindowShown(0, 0)
However, this doesn't appear to do anything. I've tried using 1 as the index as well, and doing a UI reload after (although that defeats the purpose of the macro).

Also, is there an easy way to make this toggable and keep it a macro?
  Reply With Quote
02-14-08, 04:50 AM   #2
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
Here is my code to do that:
Code:
function(status)
LayUISetups_ChatFrameIsHiden = not status
if status == 1 then
	for i=1,10 do
		local f=getglobal("ChatFrame"..i)
		if f then
			if f.LayRestore then
				f:Show()
				FloatingChatFrame_Update(f:GetID(),1)
			end
		end
	end
else
	for i=1,10 do
		local f=getglobal("ChatFrame"..i)
		if f then
			f.LayRestore=f:IsShown() or f.LayRestore
			f:Hide()
			getglobal("ChatFrame"..i.."Tab"):Hide()
			getglobal("ChatFrame"..i.."TabDockRegion"):Hide()
		end
	end
end
end
Not really fitting a macro :<


Edit:
And I'd need to check, but I think there's also another piece of code somewhere else to hook some functions or unregister some events. I've only copied that fast but I haven't read what it's supposed to do

Edit bis:
Indeed, the following functions have to be disabled if you want the chat frame to remain hidden:
"FCF_OnUpdate",
"FCF_DockUpdate",
"FloatingChatFrame_OnEvent",
"ChatFrame_ConfigEventHandler"

Last edited by Layrajha : 02-14-08 at 05:49 AM.
  Reply With Quote
02-14-08, 06:26 AM   #3
mozulo
Premium Member
 
mozulo's Avatar
Premium Member
AddOn Compiler - Click to view compilations
Join Date: Feb 2008
Posts: 82
If anyone does know a macro to hide and show the chat windows would be cool if you could post up the macro text.

thanks
__________________

  Reply With Quote
02-14-08, 07:10 AM   #4
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
Originally Posted by Layrajha View Post
Here is my code to do that:
Code:
function(status)
LayUISetups_ChatFrameIsHiden = not status
if status == 1 then
	for i=1,10 do
		local f=getglobal("ChatFrame"..i)
		if f then
			if f.LayRestore then
				f:Show()
				FloatingChatFrame_Update(f:GetID(),1)
			end
		end
	end
else
	for i=1,10 do
		local f=getglobal("ChatFrame"..i)
		if f then
			f.LayRestore=f:IsShown() or f.LayRestore
			f:Hide()
			getglobal("ChatFrame"..i.."Tab"):Hide()
			getglobal("ChatFrame"..i.."TabDockRegion"):Hide()
		end
	end
end
end
Not really fitting a macro :<


Edit:
And I'd need to check, but I think there's also another piece of code somewhere else to hook some functions or unregister some events. I've only copied that fast but I haven't read what it's supposed to do

Edit bis:
Indeed, the following functions have to be disabled if you want the chat frame to remain hidden:
"FCF_OnUpdate",
"FCF_DockUpdate",
"FloatingChatFrame_OnEvent",
"ChatFrame_ConfigEventHandler"
or you could do

Hide Code
Code:
local chat = DEFAULT_CHAT_FRAME
chat:SetScript("OnShow", chat.Hide)
chat:Hide()
Show Code
Code:
local chat = DEFAULT_CHAT_FRAME
chat.OnShow = nil
chat:Show()
  Reply With Quote
02-14-08, 12:33 PM   #5
Falcon213
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Mar 2007
Posts: 18
Actually I did figure out a solution, a bit simpler than those...
Code:
/script if ChatFrame1:IsShown() then ChatFrame1:Hide(); ChatFrame2:Hide(); else ChatFrame1:Show(); ChatFrame2:Show(); end
Thanks for the help!
  Reply With Quote
02-15-08, 06:45 AM   #6
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
Originally Posted by Slakah View Post
or you could do

Hide Code
Code:
local chat = DEFAULT_CHAT_FRAME
chat:SetScript("OnShow", chat.Hide)
chat:Hide()
Show Code
Code:
local chat = DEFAULT_CHAT_FRAME
chat.OnShow = nil
chat:Show()
True... I don't really know why I didn't think of this. I have a strange "deja-vu" feeling about this answer though



Originally Posted by Falcon213 View Post
Actually I did figure out a solution, a bit simpler than those...
Code:
/script if ChatFrame1:IsShown() then ChatFrame1:Hide(); ChatFrame2:Hide(); else ChatFrame1:Show(); ChatFrame2:Show(); end
Thanks for the help!
The problem with this is that your chat frame will pop again from time to time, for instance when you "sub-zone" (the minimap zone text changes), when you receive a message, etc...
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Hiding chat frames?


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