Thread Tools Display Modes
04-09-11, 12:05 PM   #1
daylesan
A Fallenroot Satyr
Join Date: Feb 2011
Posts: 22
Getting the currently active chat frame

I want to add a message into whatever chat window the user has switched to. I currently use this but "last active" isn't quite the same as the currently active one... there's probably a better way to do it.
Code:
LAST_ACTIVE_CHAT_EDIT_BOX:GetParent():AddMessage(msg)
LAST_ACTIVE_CHAT_EDIT_BOX:GetParent() returns ChatFrame# by the way

Last edited by daylesan : 04-09-11 at 12:13 PM.
  Reply With Quote
04-09-11, 12:15 PM   #2
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
You kind of have to track it yourself by let's say hooking the "changed chat frame" event (if there is any) and make it save the frame object reference. Take a look at the FloatingChatFrame lua file in FrameXML and ChatFrame for functions you may hook.
  Reply With Quote
04-09-11, 01:33 PM   #3
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Lua Code:
  1. ChatEdit_GetActiveWindow():GetParent()

or

Lua Code:
  1. ACTIVE_CHAT_EDIT_BOX
  Reply With Quote
04-09-11, 01:38 PM   #4
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
Funny I learned a new thing, the chat code tracks active and last active boxes natively, hehe. ^^ I just checked the code myself, didn't know that.
  Reply With Quote
04-09-11, 03:02 PM   #5
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
Code:
SELECTED_CHAT_FRAME
And why not that
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
04-10-11, 01:15 AM   #6
daylesan
A Fallenroot Satyr
Join Date: Feb 2011
Posts: 22
Thanks guys

For other people interested in this, I found out that ACTIVE_CHAT_EDIT_BOX is nil if the user is not actually typing something into the chat edit box. The chat edit box is where you type text when you press enter.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Getting the currently active chat frame

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