Hi Olivier!
TLatex worked where TText failed (at least for the example below). But has it a limit, too?
Cheers, Bernd.
-----Original Message-----
From: Olivier Couet
Sent: Tue 4/20/2004 4:38 PM
To: Bernd Reinhold
Cc: Olivier Couet; roottalk@pcroot.cern.ch
Subject: RE: [ROOT] auto-wrapping
Hi Bernd,
Yes it seems there is some limit. I can produce a crash with the following
macro:
{
TText t(0.,0,"
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX... // 284 X make it crash 283 is fine
");
}
I do not know why yet ...
Cheers, Olivier
On Tue, 20 Apr 2004, Bernd Reinhold wrote:
> Hi Olivier!
>
> Thanks for your hint. TLatex is definitely the better choice than TText.
> Though instead of using splitline, I follow the example1 in the API-doc (http://root.cern.ch/root/html/TLatex.html)
>
> TCanvas c1("c1","Latex",600,700);
> TLatex l;
> l.SetTextAlign(12);
> l.SetTextSize(0.04);
> l.DrawLatex(0.1,0.8,"1) C(x) (...));
> l.DrawLatex(0.1,0.6,"2) C(x) (...));
> l.DrawLatex(0.1,0.4,"3) R = |(...));
> l.DrawLatex(0.1,0.2,"4) F(t) (...));
> }
>
> However, if you/ anybody is still interested: I get a segmentation violation with the following strSQLstring:
>
> strSQLstring="SELECT total_number_pulls AS total_number_pulls_lc_HSA_DT, count( ID )
> FROM ( SELECT M.ID, count( pullforce ) AS total_number_pulls FROM pt_main AS M,
> pt_rawdata AS R WHERE M.ID = R.ID AND M.status = R.status AND M.status =1 AND
> M.batch LIKE '%lc_HSA_DT' GROUP BY M.ID HAVING count( pullforce ) >1 ) AS Z
> GROUP BY total_number_pulls"
>
> > TPaveText *SQLLabel=new TPaveText(.02,.02,.98,.98, "NDC");
> > TText *t1= SQLLabel->AddText(strSQLstring.c_str());
> (see in the posting from 16.Apr, below)
>
> However, it works with a smaller/ shorter strSQLstring. This led me to believe , that TText has a maximum capacity.
>
> Thanks, Olivier and cheers,
>
> Bernd.
>
> -----Original Message-----
> From: Olivier Couet
> Sent: Mon 4/19/2004 10:53 AM
> To: Bernd Reinhold
> Cc: Roottalk
> Subject: Re: [ROOT] auto-wrapping
>
> Hi,
>
> TLatex support the text splitting. Try:
>
> {
> gROOT->Reset();
> TCanvas *c1 = new TCanvas("c1","splittext",600,600);
> TLatex l(0.5,0.5,"#splitline{First line}{Second line}");
> l.SetTextFont(42); l.SetTextSize(0.05);
> l.Draw();
> }
>
> I have tried the following example to simulate the seg fault you get with
> long text but for me it work (ROOT 4.00/03 on linux)
>
> {
> gROOT->Reset();
> TCanvas *c1 = new TCanvas("c1","longtext",600,600);
> TText t(0.1,0.5,"ABCDEFGHIJKLMNOPQRSTUVWXYZ
> abcdefghijklmnopqrstuvwxyz0123456789
> ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
> t.SetTextFont(42); t.SetTextSize(0.015);
> t.Draw();
> }
>
> Cheers, Olivier
>
>
> On Fri, 16 Apr 2004, Bernd REINHOLD wrote:
>
> > 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)
> >
> >
>
>
--
Org: CERN - European Laboratory for Particle Physics.
Mail: 1211 Geneve 23 - Switzerland Mailbox: J25910
E-Mail: Olivier.Couet@cern.ch Phone: +41 22 7676522
WWW: http://cern.ch/Olivier.Couet/ Fax: +41 22 7677155
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET