Page 1 of 1

how can i add text box with scroll??

Posted: Thu Apr 09, 2009 5:44 am
by Malgodur
I want to add messages in this box, so i ask how to ADD such box, how to print an messae in it, and how to save whole box text to file... btw im using wchar_t and wstring. Please help

Posted: Thu Apr 09, 2009 8:06 pm
by Ion Dune
Tutorial 5 (also found in the SDK) should help you with setting up the GUI you're asking for. As for saving the text to a file, use the File System to create a write file and then write to it, something like this:

Code: Select all

irr::io::IWriteFile * File = FileSystem->createAndWriteFile("output.txt") ;
irr::core::stringc str( wstring.c_str() ) ;
File->write( str.c_str() , str.size() ) ; //should work
(This should work, I haven't tested it though.) In theory, you could write the wchar_t's to the file if you wanted, but you would have to take into account the size of the wchar_t, like so:

Code: Select all

File->write( wstr.c_str() , str.size() * sizeof( wchar_t ) /*not sure of this syntax*/ ) ; 
and also programs such as NotePad might still try to open the file as if it was ASCII, not sure.