Hi ROOTers
I am trying to draw a clone of a subpad into a new canvas. How can I do that?
This is what I am doing…
1---->I create a master canvas and I split the canvas into n subpads.
At each subpad I add the following executable function:
//…
2---->I Then I defined my saving pad option next:
[code]void APIanalyzer::SaveCurrPad(){
int event = gPad->GetEvent();
if (event != 11) return;
TObject *select = gPad->GetSelected();
if (!select) return;
if (select->InheritsFrom(“TGraph”)) {
//... Do something. ...
}
else if (select->InheritsFrom(“TPad”)){
fEcanvas->GetCanvas()->SetPadSave((TPad *)gPad);
}
fEcanvas->GetCanvas()->GetCanvas()->FeedbackMode(kTRUE);
}[/code]
3---->I Finally I draw my clone pad. The problem I am having is that it draws a clone of the whole TCanvas object instead of the selected saved pad. The second problem I have is that my TCanvas (Actually it is a TRootEmbeddedCanvas in a TGMainFrame object) doesn’t update while I move the new canvas.
[code]void APIanalyzer::DrawCanvasClone(){
//Could I use GetClickedSelectedPad here???
TPad *currPad = (TPad *)fEcanvas->GetCanvas()->GetPadSave();
if(!currPad) return;
TCanvas *myc=new TCanvas();
fEcanvas->GetCanvas()->SetSelectedPad(currPad);
fEcanvas->GetCanvas()->DrawClonePad();
fEcanvas->AdoptCanvas(myc); //For proper destruction
}
[/code]
What am I doing wrong?
Kris