Problem with TPad

Hi,

the following code used to work in the version 4.00.08 for windows but does not work for version 4.01.04 or higher.

The problem is that when I run the code I can no longer select a sub pad by clicking the middle mouse button. I can only select the base canvas.

fCanvas = new TRootEmbeddedCanvas(“Canvas”, this, 800, 400);
AddFrame(fCanvas);

for (i=0 ; i<2 ; i++) {
fGraph[i] = new TGraph(1024);
}

fCanvas->GetCanvas()->Divide(2, 1, 0, 0);
fCanvas->GetCanvas()->cd(1);

for (i=0 ; i<2 ; i++) {
for (j=0 ; j<1024 ; j++) {
fGraph[i]->SetPoint(j, j, (double)rand()/200);
}
fCanvas->GetCanvas()->cd(i+1);
fGraph[i]->Draw(“AL”);
}
fCanvas->GetCanvas()->Modified();
fCanvas->GetCanvas()->Update();
MapSubwindows();
MapWindow();

Thanks for help

Matthias

Hi Matthias,

According to the reference guide the comments of the method TPad::Divide say:

“in case xmargin <=0 and ymargin <= 0, there is no space between pads. The current pad margins are recomputed to optimize the layout.”

i.e. using 0 for xmargin and ymargin your code creates two pads with no borders and in this case you cannot see which one is selected by clicking the middle mouse button.

Cheers, Ilka