how can i add text box with scroll??

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Malgodur
Posts: 195
Joined: Sun Mar 15, 2009 8:22 pm

how can i add text box with scroll??

Post 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
Ion Dune
Posts: 453
Joined: Mon Nov 12, 2007 8:29 pm
Location: California, USA
Contact:

Post 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.
Post Reply