Dear root masters,
I found something at least peculiar in the behaviour of TCanvas within
cint interpreter:
1) when I create a TCanvas object with:
t = new TCanvas("","",100,100);
the canvas is not created, but if I type:
t2 = new TCanvas("name","title",100,100);
the canvas is really created. (it appears on the screen)
2) Now suppose I want to divide the canvas t2 into two, without
space inbetween and both on the same line, then I have to do:
t2->Divide(2,1,0.,0.);
But then I have no access to the pads:
t2_1->cd(); // or
c1_1->cd();
both commands returns error messages.
3) To get tcanvas::divide to work, one must create the canvas with:
t3 = new TCanvas();
and then one have no control over the dimensions (w x h) but the
TCanvas::Divide works fine. Well, not so fine:
4) why the pads are named c1_1 and c1_2.... and not t3_1 and t3_2??
Naming all divided pads with c1_[index] make it not possible, for
exemple, to divide two canvas that exist at the sametime. What
happens is that the second divided canvas does not respond to c1_1->cd().
I know that it is most probably that I am missing something, but I
could not figure out what. I am using linux redhat 7, and I tried it with
root3.02/06 and root 3.03.
I am sending attached a macro with the commands I have described
and its result from within the interpreter. I hope it is of some
help.
thanks,
Henrique Barbosa
--------------------
Campinas - Brasil
The Pierre Auger Observatory
{
t = new TCanvas("","",800,400);
t2 = new TCanvas("a","b",800,400);
t2->Divide(3,2,0.,0.);
t2_1->cd();
c1_1->cd();
t3 = new TCanvas();
t3->Divide(3,2,0.,0.);
t3_1-cd();
c1_1->cd();
t3->~TCanvas();
t4 = new TCanvas();
t4->Divide(3,2,0.,0.);
c1_1->cd();
t5 = new TCanvas();
t5->Divide(3,2,0.,0.);
c1->cd();
c1_1->cd();
c1_n4_1->cd();
c1_n4->cd();
t4->cd();
t5->cd();
c1_1->cd();
t4->cd();
c1_1->cd();
t5->cd();
c1_1->cd();
t5->Divide(3,2,0.,0.);
c1_1->cd();
}
root [0] t = new TCanvas("","",800,400)
(class TCanvas*)0x86485c0
root [1] t2 = new TCanvas("a","b",800,400)
(class TCanvas*)0x8648a90
root [2] t2->Divide(3,2,0.,0.)
root [3] t2_1->cd()
Error: No symbol t2_1 in current scope FILE:/tmp/fileqRsNkD_cint LINE:1
Error: Failed to evaluate t2_1->cd()Possible candidates are...
filename line:size busy function type and name
*** Interpreter error recovered ***
root [4] c1_1->cd()
Error: No symbol c1_1 in current scope FILE:/tmp/filetQ0awX_cint LINE:1
Error: Failed to evaluate c1_1->cd()Possible candidates are...
filename line:size busy function type and name
*** Interpreter error recovered ***
root [5] t3 = new TCanvas()
(class TCanvas*)0x868e020
root [6] t3->Divide(3,2,0.,0.)
root [7] t3_1-cd()
Error: No symbol t3_1 in current scope FILE:/tmp/fileKBEXuf_cint LINE:1
(const int)0
*** Interpreter error recovered ***
root [8] c1_1->cd()
root [9] t3->~TCanvas()
root [10] t4 = new TCanvas()
(class TCanvas*)0x85a7670
root [11] t4->Divide(3,2,0.,0.)
root [12] c1_1->cd()
root [13] t5 = new TCanvas()
(class TCanvas*)0x868f4b0
root [14] t5->Divide(3,2,0.,0.)
root [15] c1->cd()
root [16] c1->cd()
root [17] c1_1->cd()
root [18] c1_n4_1->cd()
Error: No symbol c1_n4_1 in current scope FILE:/tmp/fileFIuFVm_cint LINE:1
Error: Failed to evaluate c1_n4_1->cd()Possible candidates are...
filename line:size busy function type and name
*** Interpreter error recovered ***
root [19] c1_n4->cd()
root [20] t4->cd()
root [21] t5->cd()
root [22] c1_1->cd()
Error: No symbol c1_1 in current scope FILE:/tmp/filem6YNAN_cint LINE:1
Error: Failed to evaluate c1_1->cd()Possible candidates are...
filename line:size busy function type and name
*** Interpreter error recovered ***
root [23] t4->cd()
root [24] c1_1->cd()
root [25] t5->cd()
root [26] c1_1->cd()
Error: No symbol c1_1 in current scope FILE:/tmp/fileDUBl8m_cint LINE:1
Error: Failed to evaluate c1_1->cd()Possible candidates are...
filename line:size busy function type and name
*** Interpreter error recovered ***
root [27] t5->Divide(3,2,0.,0.)
root [28] c1_1->cd()
Error: No symbol c1_1 in current scope FILE:/tmp/fileGpXal2_cint LINE:1
Error: Failed to evaluate c1_1->cd()Possible candidates are...
filename line:size busy function type and name
*** Interpreter error recovered ***
root [29] .q
This is the end of ROOT -- Goodbye
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:47 MET