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,
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
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
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
Thanks for your reply.
In my codes, I did declare it as std::String str.
Just simply put String here to illustrate:)
Wojtek wrote:
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
Hi,
Hmm, still have doubts. Because of uppercase String name yu just wrote.
std::String does not exist. I would be ok, though, if you wrote you did
declare it as std::string (lowercase) ;-). But lets assume you did just
that and it still does not work, so then I would suggest to enter setText
Forgive my silly typo, I did mean std::string.
It is strange that now
std::string str = This is the first line \n This is
the second line;
text-setText(str);
works!!!
I don't know why it failed two hours ago.
But if I change the str content with
Here is what I get:
Set the text using a std::string, which is converted to an internal TextString.
I think I should find out the secret of TextString.
Oceane wrote:
Forgive my silly typo, I did mean std::string.
It is strange that now
std::string str = This is
Problem solved!
Because I read texts from XML files, so I just put '
' instead of '\n'.
Thanks for all the replies above!
--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=56126#56126
___
osg-users
9 matches
Mail list logo