[ROOT] auto-wrapping

From: Bernd REINHOLD (Bernd.Reinhold@cern.ch)
Date: Fri Apr 16 2004 - 16:02:53 MEST


Hi!

I'd like to display a TText within a TPad. But the TText is bigger than 
TPad. Is there something like an option 'auto-wrap'? Does TText display 
text only in one line? Is there a multiple-line version of TText? 
I tried to use TPaveText, also, but didn't succeed. (see below for the 
code I used, probably you can give me some hints for improvement)

And: Is there a limit for the length of the (C)string, that TText can 
take (I got a segmentation violation) with a longer Cstring.

I use root 3.10.02 an CERN RedHat 7.3...


the code: I tried different variations of that...
SQL_Date is a subpad of a canvas (this works)
	TPad *SQL_Date = new TPad("SQL_Date", "SQL and date",.02,.3,.98,.49);
	SQL_Date->Draw();	
	SQL_Date->cd();

	TPaveText *SQLLabel=new TPaveText(.02,.02,.98,.98, "NDC");
	TText *t1= SQLLabel->AddText(strSQLstring.c_str());
	t1->SetTextSize(0.07);
	SQLLabel->Draw();
	t1->Draw();
	SQL_Date->Update();
	SQL_Date->Modified();
	c1->Update();

found now, that this might be due to the textColor (white!!!). Now I can 
see the t1, but still it is a TText, still it's only one line...

another try:
	TPad *SQL_Date = new TPad("SQL_Date", "SQL and date",.02,.3,.98,.49);
	SQL_Date->Draw();	
	SQL_Date->cd();

	TText* Comment=new TText(0.04,0.2, strComment.c_str());
	Comment->SetTextSize(0.07);
	Comment->Draw();
	SQL_Date->Modified();
	c1->Update();

this drew both SQL_Date and inside the Comment, but it was too long (no 
auto-wrap)



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET