Game Development Community

Bug in GuiTextEditCtrl::selectAllText with fix.

by William Lee Sims · in Torque Game Builder · 03/02/2010 (3:05 am) · 1 replies

First, I'm sorry to post this here. Fortunately, this is a public forum and can be searched. If there's a better place to put common bugs, just let me know!

When I call "selectAllText" on a GuiTextEditCtrl, I'm finding that it only hilights the length of the original text.

For example, if the original field said "Bill", and I type in "William", and then I call "selectAllText", it only hilights "Will".

I've modified the function to this:
void GuiTextEditCtrl::selectAllText()
{
  mBlockStart = 0;
  mBlockEnd = mTextBuffer.length();
  setUpdate();
}
and that seems to work. I tested it as much as I could (including blank strings) and didn't run into any problems.

(Edit: I saw that this same function was fixed in Torque3D Beta 4. I checked its solution and it matches mine. I guess if you are using TGB or TGE, you may still want this.)

#1
03/03/2010 (12:30 pm)
Hi William,
yes, I use TGB and I still want this post :-) I think any TGB fix is always welcome.

Thanks for sharing.