nope it isnt working because the gui element isnt parsing the line, which you are about to add. You may need to create a new element and go through the string and if you find a \n you simply create a new line and add the rest of the string after \n...
I couldn't get the XML writer to write wide \n's for some reason, they'd always end up as one char...
however, L"\u000D\u000A" seems to work okay, at least here in windows. I didn't really investigate why, it was a trial and error thing
So is there an easy way of accomplishing the task of doing a newline / CR / LF in a staticText? Haven't tried an edit box yet but I'm assuming the same things happens when trying to do a standard "\n".
Currently I'm using a listbox because I was tired of wasting time looking through code and chat examples.
Damn, I thought you figured it out by now JP . It's pretty odd that you can't do any type of newline type stuff on a staticText (and edit box?). And pretty frustrating too. There's gotta be a simple way of doing it...
Xhrit from IRC showed me an example that parses the text but I haven't tried it yet (or tried to understand it yet for that matter):
Okay, it doesn't work for writing text using CGUIText, line breaks have to be inserted manually. see breakText() in CGUIStaticText.
it compares the text to a L'\n', which I is held internally as a token eg 0x000a (depending on compiler?) until its written out then its converted.. unless of course you're writing out to disk in binary mode (which the xml writer does), then the internal representation is written out.
in text mode \x0a's are replaced with the platform specific \n characters
using guiStaticText->setText(L"Some\nNewline") works fine for me, how were you using it JP?
bitplane wrote:Okay, it doesn't work for writing text using CGUIText, line breaks have to be inserted manually. see breakText() in CGUIStaticText.
it compares the text to a L'\n', which I is held internally as a token eg 0x000a (depending on compiler?) until its written out then its converted.. unless of course you're writing out to disk in binary mode (which the xml writer does), then the internal representation is written out.
in text mode \x0a's are replaced with the platform specific \n characters
using guiStaticText->setText(L"Some\nNewline") works fine for me, how were you using it JP?
If I used it like you said (and like I was trying initially), it prints out a [] (box) character. No screenies atm but I can show one later. I'm using Dev-C++ with gcc (g++) to compile it on windows.
I'll take a look at breakText a bit later. Thanks bitplane.