Game Development Community

Help with Text Editing (GuiMLTextEditCtrl)

by Gareth Fouche · in Torque Game Engine · 08/08/2006 (12:08 am) · 6 replies

I'm trying to implement a gui where I can edit a description, then when I press save it saves it, simple enough.

I want something like a "memo" from other visual tools, ie a big white box you edit text in, rather like the one that I am writing this post up in ;)

GuiTextEditCtrl doesn't seem to be a good fit, since it is a one line component. So I put a guiMLTextEditCtrl in a scrollbar component, and that seems to be exactly what I want.

But I've run into a problem. When I call "getText()" on it, the string it returns is missing a few characters. Or rather, it seems to be. So if it has "Hows it going?" in the panel, it returns "Hows it goin".

Now, I've poked about in the code, put in some printf statements, and it seems the component returns the right number of characters, it just displays them incorrectly. Looking at it, it seems to convert the string to some generic internal format, UTF16 or something, whose length() doesn't include the null character. When you ask for the text back, I think it converts it back again. Is something being lost in that conversion?

If the returned string is the same length as the original, but prints out as cut off, is it missing a escape character? I tried manually setting the last char to 0, no luck.

Has anyone else experienced this? Am I just doing something wrong? Has it got something to do with the ML stuff? I tried calling StripML...() on the returned string, again, nothing.

Any ideas?

#1
08/08/2006 (4:25 am)
Bump.
#2
08/08/2006 (4:34 am)
Man, if everyone would bump their threads after 4 hours, this place would be chaos.
#3
08/08/2006 (4:37 am)
Alright, fair enough. Sorry.
#5
08/08/2006 (6:12 am)
I think I read somewhere that it was a Unicode issues fixed in 1.4.2. Not sure though, and couldnt find the threads that dealed with it. Hopefully Tom's link will help.
#6
08/08/2006 (7:38 am)
Thanks guys.