Just like in the question, be able to determine when the player has begun typing within the chat box and know when they stopped typing / close the chat
In the text box, use :IsFocused() to see if a player is typing in the chatbox. http://wiki.roblox.com/index.php?title=API:Class/TextBox is where you will find all the 'focus' items.