0

How to put newline \n to Out_box object? If i do something like:

//....    
Out_box ob;    
//...    
ob.put("first line \n second line");    

Output looks like:

first line ^J second line

And, I want something like that:

first line
second line

I figure it out. I think it may helpfull for someone. If you want to make Out_box to maintain multiply lines, you need to change definiton of Out_box::put and Out_box::attach in Gui.cpp. Don't forget to include

#include <FL/Fl_Multiline_Output.H>
//...
void Out_box::put(const string& s)
{
    //reference_to<Fl_Output>(pw).value(s.c_str());
    reference_to<Fl_Multiline_Output>(pw).value(s.c_str());
}

 //------------------------------------------------------------------------------

 void Out_box::attach(Window& win)
{
    //pw = new Fl_Output(loc.x, loc.y, width, height, label.c_str());
    pw = new Fl_Multiline_Output(loc.x, loc.y, width, height, label.c_str());
    own = &win;
}
4

0 回答 0