Page 2 of 2

Posted: Tue Oct 31, 2006 8:36 pm
by JP
bitplane wrote: using guiStaticText->setText(L"Some\nNewline") works fine for me, how were you using it JP?
Yeah that's how i've been using it, and it just treats the \n as a space basically :?

Posted: Tue Oct 31, 2006 10:36 pm
by Rytz
This:
Image

...is what I get when I do:

Code: Select all

lstLoginStatus->addItem(L"Logging in \n to the server...");
Now granted that's a listbox (dunno how those work with linefeeds) but it's the same thing that happens to the staticText's.

Posted: Wed Nov 01, 2006 5:05 am
by vitek
List boxes don't work with line feeds. I don't think I've ever seen a listbox that did. For the static text to work, the wordWrap flag has to be set. At least on vc7 it does...

BTW, the static text appears to have a bug in that it doesn't split words/strings when they are wider than the width of the static text area.

Posted: Wed Nov 01, 2006 10:52 am
by JP
Excellent, word wrap seems to make it work now :D

Posted: Wed Nov 01, 2006 4:27 pm
by Rytz
JP wrote:Excellent, word wrap seems to make it work now :D
Awesome, I'll have to give it a shot later today.

Thanks, Vitek ;).

Posted: Thu Nov 02, 2006 3:51 pm
by gavicus
wchar_t is generally a pain to work with for me. Let me add a question to this line. This is just C++ (maybe C) and not Irrlicht

I'd like to tell the gui static text to display a varying number (say camera location or something)

I can tell it to set text to L"camera location" but how can I stick a number on it? I could do this with a std::string but how do you convert from string to wchar_t?

Posted: Thu Nov 02, 2006 5:26 pm
by JP
you can do something along the lines of this:

wchar_t wStr[255];
swprintf(wStr, 255, L"%f %f %f", camX, camY, camZ);
text->setText(wStr);

Or you can use Irrlicht's built in Strings, stringw and stringc.

stringw str;
str += camX;
//etc.
text->setText(str.c_str());