Postby Biff_Cornwall » 10 Nov 2009, 20:44
Hey cksachdev,
Thanks for the response!
We log the chat messages between users (via a ChatLog class that I've written) as long as they stay in the same room. The chat window is accessed by clicking on the user (which displays a user information panel) and clicking on a chat button in the panel. That in turns opens up the chat window, where the chatbox is created. If they have chatted previously (and neither have left the room), we want to display their previous chat messages out of convenience. This way, when they aren't chatting they can close the user information panel, but still keep up with their chat when they go back to it.
I actually spent two full days debugging this issue and chased the bug all the way down into the source code (thank goodness we purchased it!).
It turns out both the setPrivateChatUserId() method and the setMessagesQueue() method were being executed before the draw() method. Because of this, the text in the ta_chat box was not being rendered on the screen, even though it was technically there (which was why it was showing up in my trace statements, but not on screen).
Also, it really had nothing to do with removing the chatbox and then instantiating it again. I thought that was the issue at first, but it turns out that any time you create an instance of the chat box and you try to pre-populate the ta_chat text area, this bug will occur. The only reason I thought it was due to removing and instantiating again was because of the user click-through flow, where there wouldn't be any chat history the first time it was instantiated, so there would be no pre-population of the ta_chat text area.
I've submitted my findings to the SmartFox team and came up with a simple (albeit a bit shoddy) patch to ensure the setPrivateChatUserId() method doesn't execute until the draw() method is complete, and it works perfectly now.
Thanks!
Biff