TGTextView question

Hello ROOTers! I have a normal string (although quite long) with some ‘\n’ characters inside. When I try to import it in TGTextView->AddText(…) it gets print out correclty but the ‘’\n’ characters do not break the line and appear as small boxes (probably non printable character symbol. Is this the expected behaviour? If yes, how can I import the string inside TGTextView or something similar and force the output on the screen to be broken into lines where the ‘\n’ character is? I note that the same string prints correctly at the console. Thanks,

Filimon

Hi Filimon,

The parameter of AddText method is a multi line text buffer (TGText). It allows the text to be loaded from a file. My guess is that your string is a const char *str and in that case you have to use the method TGTextView::LoadBuffer(str).

Best regards, Ilka

Hello! Actually I used a temporary TGText(char *) constructor previously. Your proposal prints out correctly, however it erases the previous contents of TGTextView. So, I need the behaviour of AddText (concatenation) with the printing of LoadBuffer. Is there any method for this? Best regards,

Filimon

Hi Filimon,

The following lines might help: TGText txt; txt.LoadBuffer(buff); ftextview->AddText(&txt);
where ‘buff’ is a const char* containing the text. If they do not help, please provide a short macro that will help us to reproduce your case and to see the problem.

Thank you, Ilka

ok, this does what I wanted! I should have thought of it! Thanks,

Filimon