TGB guiMLTextCtrl bug (and fix)
by Chris Labombard · in Torque Game Builder · 04/10/2006 (6:50 pm) · 6 replies
Ok... I found a bug and fixed it. Details are here.
Basically, it cut off the last letter before all the < tags, which was bad.
Basically, it cut off the last letter before all the < tags, which was bad.
About the author
I have been a professional game programmer for over 5 years now. I've worked on virtually every platform, dozens of games and released a few of my own games, including 2 iPhone titles and a title waiting release on Big Fish Games.
#2
04/15/2006 (10:30 am)
Neither can I. Anyone wanna move that to a t2d accessible location?
#3
04/18/2006 (11:03 am)
Anyone?
#4
-------------
Ok. I managed to fix the issue where it cut off the last letter before all of the tags.
This is for TGB (btw). Specifically Beta2.
Go to the end of void GuiMLTextCtrl::reflow()
and replace this:
with this:
I bolded the difference.
Now I'm going to figure out why my other problem is occuring. and since the TGB dev team probably won't see this, I should email one of them...
04/18/2006 (11:12 am)
I cant remember if this is the only change I had to make. Sorry guys. i think it is. Here is the post I made on that forum:-------------
Ok. I managed to fix the issue where it cut off the last letter before all of the tags.
This is for TGB (btw). Specifically Beta2.
Go to the end of void GuiMLTextCtrl::reflow()
and replace this:
textemit:
textStart = mScanPos;
idx = 1;
while(mTextBuffer.getChar(mScanPos+idx) != '\t' && mTextBuffer.getChar(mScanPos+idx) != '<' && mTextBuffer.getChar(mScanPos+idx) != '\n' && mTextBuffer.getChar(mScanPos+idx))
idx++;
len = idx;
mScanPos += idx;
emitTextToken(textStart, len);
}
processEmitAtoms();
emitNewLine(mScanPos);
resize(mBounds.point, Point2I(mBounds.extent.x, mMaxY));
Con::executef( this, 3, "onResize", Con::getIntArg( mBounds.extent.x ), Con::getIntArg( mMaxY ) );
//make sure the cursor is still visible - this handles if we're a child of a scroll ctrl...
ensureCursorOnScreen();
}with this:
textemit:
textStart = mScanPos;
idx = 1;
while(mTextBuffer.getChar(mScanPos+idx) != '\t' && mTextBuffer.getChar(mScanPos+idx) != '<' && mTextBuffer.getChar(mScanPos+idx) != '\n' && mTextBuffer.getChar(mScanPos+idx))
idx++;
len = idx;
mScanPos += idx;
emitTextToken(textStart, [b]len + 1);//CFL[/b]
}
processEmitAtoms();
emitNewLine(mScanPos);
resize(mBounds.point, Point2I(mBounds.extent.x, mMaxY));
Con::executef( this, 3, "onResize", Con::getIntArg( mBounds.extent.x ), Con::getIntArg( mMaxY ) );
//make sure the cursor is still visible - this handles if we're a child of a scroll ctrl...
ensureCursorOnScreen();
}I bolded the difference.
Now I'm going to figure out why my other problem is occuring. and since the TGB dev team probably won't see this, I should email one of them...
#5
-------------------------
I'm echoing guiMLTextCtrl.getText() for my help Dlg which is a guiMLTextCtrl inside a scroller, and it has all the text.
However, it still doesn't display the text properly. It loses the last character of every line.
for example :
displays as "About", when it should be "About:"
Has anyone else discovered and/or fixed this?
This doesn't work either...
It displays as:
"Chris Labombard ("
I should note. I'm using TGB (The newest beta, beta2)... and this worked in 1.0.2
04/18/2006 (11:12 am)
This was the post I made before thato ne:-------------------------
I'm echoing guiMLTextCtrl.getText() for my help Dlg which is a guiMLTextCtrl inside a scroller, and it has all the text.
However, it still doesn't display the text properly. It loses the last character of every line.
for example :
<font:Arial Bold:16>About[b]:[/b]<font:Arial:16>
displays as "About", when it should be "About:"
Has anyone else discovered and/or fixed this?
This doesn't work either...
<linkcolor:0000a0><linkcolorhl:00a0ff>Chris Labombard ( <a:www.garagegames.com/my/home/view.profile.php?qid=47988>Profile </a> ) ( <a:www.spunkygames.com/>Web Site </a> )
It displays as:
"Chris Labombard ("
I should note. I'm using TGB (The newest beta, beta2)... and this worked in 1.0.2
#6
If you run the code and have the exception, just use adebugger to trace the call stack and make the neccessary change.
Still enver fixed problem 2. I traced it down to an issue where reflow doesnt properly parse multiple font tags on 1 line.
Also, line breaks are unusually large. Dont know how to fix that either.
Sorry Im not of more help...
04/18/2006 (11:15 am)
I should note, this did cause an exception in stringBuffer, and I cant recall where it was. :( Basically a problem where I was trying to index a string at length + 1.If you run the code and have the exception, just use adebugger to trace the call stack and make the neccessary change.
Still enver fixed problem 2. I traced it down to an issue where reflow doesnt properly parse multiple font tags on 1 line.
Also, line breaks are unusually large. Dont know how to fix that either.
Sorry Im not of more help...
Torque Owner Adam Johnston