Thread Tools Display Modes
07-13-09, 12:37 PM   #1
Monk1nr
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 4
KgPanels and Chat Fading

I am sure someone has an answer for me, but I have looked for quite a while and found nothing.

Here is my problem: I have a panel that is parented and anchored to my Chatter chat frame and that is working fine. What I would like, however is that when chatter fades all the way out, I want my panel to do the same. I am assuming it stays because Chatter does not really go away but merely has no text visible.

What script can I add to the panel to have it disappear when Chatter does?

Thanks in advance and I apologize if this has been asked before.
-Corey
  Reply With Quote
07-15-09, 12:01 PM   #2
Monk1nr
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 4
Dang. 31 views and no reply. Has no one figured this out? There has to be a way to check if something is being shown on the chat frame.
  Reply With Quote
12-14-10, 10:20 AM   #3
yllelder
A Kobold Labourer
Join Date: Mar 2007
Posts: 1
Does anyone know?
  Reply With Quote
07-09-11, 03:38 PM   #4
Shixin
A Defias Bandit
Join Date: Jul 2011
Posts: 2
Exclamation Still looking?

I'm needing this, too. Trying to make the panel that is parented to one of my chat boxes fade when the text fades.

Found this script from Real on the interwebz, but it's not working so I'm thinking it's too old:

Code:
local kgp = self;
 local fadetime = 0.3;
 ChatFrame5:HookScript("OnShow", function(self)
 UIFrameFadeIn(kgp, fadetime, kgp:GetAlpha(), 1);
 end)

 ChatFrame5:HookScript("OnHide", function(self)
 UIFrameFadeOut(kgp, fadetime, kgp:GetAlpha(), 0.5);
 end)
Help??
  Reply With Quote
07-09-11, 04:01 PM   #5
Nibelheim
local roygbi-
 
Nibelheim's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 1,600
Do you want the panel to hide when the text in the chat frame hides? Or when all the objects of the chat frame hide (tabs, background, etc)?
  Reply With Quote
07-10-11, 05:27 AM   #6
sylvanaar
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 92
The fading out of the chat text is a function of Blizzard's widget, each line can have a different alpha value, so you would need to decide how to handle that.

Here is an example that gets the text with the maximum alpha:



Code:
function GetChatAlpha(frame)
    if frame == nil then return end
        
    local lines = { frame:GetRegions() }

    local maxAlpha = 0
    for i=#lines, 1, -1 do
        if lines[i]:GetObjectType() == "FontString" then
            maxAlpha = math.max(maxAlpha, lines[i]:GetAlpha())
        end
    end

    return maxAlpha
end
You can test it like

/script print(GetChatAlpha(ChatFrame1))

wait for the text to fade then run the same script to see it goes to 0.

This only works for visible chatframes though. Text on frames that arent visible doesn't get faded out until the frame is made visible again.
  Reply With Quote
07-10-11, 01:38 PM   #7
Shixin
A Defias Bandit
Join Date: Jul 2011
Posts: 2
Ah, thanks for the replies!

I want the panel to fade when the text itself completely fades away, leaving an empty chat frame; mine don't disappear 100% but they do fade a lot (see 4 chat frames in lower left corner, one has the kgpanel missing to demonstrate the end result of fading):



So if I know the alpha value of the chat, then what Sylv? Sorry, I'm not good on writing scripts, not at all.

Last edited by Shixin : 07-10-11 at 03:10 PM.
  Reply With Quote
07-10-11, 03:58 PM   #8
sylvanaar
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 92
Well then you know when it has beed faded out (alpha = 0)

You would need to write an onupdate to poll it though.

I don't know much about KgPanels, maybe someone else could help you integrate it.

Last edited by sylvanaar : 07-10-11 at 04:03 PM.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » KgPanels and Chat Fading

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