Probable Bug in guiMLTextCtrl's getTextContent()
by Jon Wilsdon · in Torque Game Engine Advanced · 10/09/2006 (8:38 am) · 2 replies
We ran into a problem where we were getting the text from a GuiMLTextCtrl and then adding onto the returned text. The new text would always get cut off by 3 characters, sometimes leading to some really odd behavior. It seems that there is a slight disconnect between the functionality in Unicode.cpp when converting from UTF[16|32] to UTF8 and the getTextContent function.
Here is the solution that seems to work for us:
around line 380 of gui/controls/GuiMLTextCtrl.cpp in function GuiMLTextCtrl::getTextContent() change:
The Unicode conversion functions appear to work correctly every time that they are called except for when called from the getTextContent() function, at least in our tests. Also, the getText function might also need to be corrected, although from what I can tell it is never used. (The getText console method calls getTextContent() and not getText()).
Here is the solution that seems to work for us:
around line 380 of gui/controls/GuiMLTextCtrl.cpp in function GuiMLTextCtrl::getTextContent() change:
from:
mTextBuffer.get(returnString, mTextBuffer.length() );
to:
mTextBuffer.get(returnString, mTextBuffer.length()+3 );The Unicode conversion functions appear to work correctly every time that they are called except for when called from the getTextContent() function, at least in our tests. Also, the getText function might also need to be corrected, although from what I can tell it is never used. (The getText console method calls getTextContent() and not getText()).
#2
10/10/2006 (3:46 pm)
Whoops, I didn't think that line number through as we have made a decent amount of changes to guiMLTextCtrl, and I forgot to put the function name for easy reference in case my line number was wrong. Our code base is usually in sync with the latest from cvs, I just forget to check if we have modified the cpp files sometimes. I will update the first post to represent the line number and function name, which are line 380 and GuiMLTextCtrl::getTextContent() respectively in a vanilla cvs check out.
Torque Owner Brian Ramage
Black Jacket Games