Hi,

Its just a guess, but I believe your call:
   text->setText("This is the first line \n This is the second line");
is done implicit conversion to std::string and calling following method:
  TextBase::setText( const std::string & );
so in your code I would try declaring str variable as std::string (not a
String as you did).

Cheers,
Wojtek Lewandowski




2013/9/5 Fan ZHANG <[email protected]>

> Thanks for your reply but it still does not work:(
>
>
>
> Sebastian Messerschmidt wrote:
> > Hi Fan,
> >
> > Could you try:
> >
> > String str = "This is the first line \\n This is the second line";
> > text->setText(str);
> >
> > (note the double \)
> >
> > cheers
> > Sebastian
> >
> > > Hi all,
> > >
> > > Sorry to disturb but I have a question about the line breaker '\n'.
> > >
> > > If I use text->setText("This is the first line \n This is the second
> line");
> > >
> > > It works and gets the result as:
> > >
> > > This is the first line
> > > This is the second line
> > >
> > > But if I read the string from a variable, it does not work, namely,
> > >
> > > String str = "This is the first line \n This is the second line";
> > > text->setText(str);
> > >
> > > The result will be:
> > >
> > > This is the first line \n This is the second line
> > >
> > >
> > > Anyone knows why and how to deal with it?
> > >
> > > I have to read lots of texts from external files.
> > > So it is impossible to do it in the first way to directly put the
> texts there, but to read texts each time.
> > >
> > >
> > >
> > > Thanks in advance for any kind reply!
> > >
> > > Cheers,
> > >
> > > Fan
> > >
> > > ------------------
> > > Read this topic online here:
> > > http://forum.openscenegraph.org/viewtopic.php?p=56110#56110
> > >
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > osg-users mailing list
> > >
> > >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > >
> >
> > _______________________________________________
> > osg-users mailing list
> >
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> >  ------------------
> > Post generated by Mail2Forum
>
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=56116#56116
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to