Two TRootEmbeddedCanvas problem of connection with Handle

Hi Rooters,

The ROOT 5.24 is used under Windows XP with MVS 2008.
In the stadealone code 3 objects of the TRootEmbeddedCanvas are used.
Each of them is connected with own handle as the first one

fMXY->GetCanvas()->Connect(“ProcessedEvent(Int_t,Int_t,Int_t,TObject*)”, “GS3d_MainFrame”,this,“HandleMXY(Int_t,Int_t,Int_t,TObject*)”);

If the mouse is simply mooving over one of these object the corresponding code is called. That is correct. When I click on the one of these object then in the first time the corresponding code is called but in the next time (when another object is clicked) the same code is called.

1 click on fMXY -> HandleMXY is called
2 click on fMYZ -> HandleMXY is called instead of HandleMYZ

What may be is wrong?
Andrey

Hi Andrey,

No idea, but I’ll try to reproduce the problem and let you know as soon as possible.

Cheers, Bertrand.

Hi,

I cannot reproduce the problem. I tried with the following code:

[code]#include “TGTableLayout.h”
#include “TGFrame.h”

HandleC1(Int_t ev,Int_t,Int_t,TObject*)
{
if (ev == kButton1Up)
printf(“HandleC1(Int_t,Int_t,Int_t,TObject*)\n”);
}

HandleC2(Int_t ev,Int_t,Int_t,TObject*)
{
if (ev == kButton1Up)
printf(“HandleC2(Int_t,Int_t,Int_t,TObject*)\n”);
}

HandleC3(Int_t ev,Int_t,Int_t,TObject*)
{
if (ev == kButton1Up)
printf(“HandleC3(Int_t,Int_t,Int_t,TObject*)\n”);
}

HandleC4(Int_t ev,Int_t,Int_t,TObject*)
{
if (ev == kButton1Up)
printf(“HandleC4(Int_t,Int_t,Int_t,TObject*)\n”);
}

void TableCanvas()
{
TGMainFrame * w = new TGMainFrame (gClient->GetRoot(), 800, 800);
TGTableLayout tl = new TGTableLayout(w, 2, 2, kFALSE);
w->SetLayoutManager(tl);
TRootEmbeddedCanvas ec = new TRootEmbeddedCanvas(“Ecanvas1”, w, 200, 200);
w->AddFrame(ec, new TGTableLayoutHints(0, 1, 0, 1,
kLHintsExpandX | kLHintsExpandY |
kLHintsShrinkX | kLHintsShrinkY |
kLHintsCenterX | kLHintsCenterY |
kLHintsFillX | kLHintsFillY,
1, 1, 1, 1));
ec->GetCanvas()->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject
)", 0, 0, "HandleC1(Int_t,Int_t,Int_t,TObject
)");

ec = new TRootEmbeddedCanvas(“Ecanvas2”, w, 200, 200);
w->AddFrame(ec, new TGTableLayoutHints(1, 2, 0, 1,
kLHintsExpandX | kLHintsExpandY |
kLHintsShrinkX | kLHintsShrinkY |
kLHintsCenterX | kLHintsCenterY |
kLHintsFillX | kLHintsFillY,
1, 1, 1, 1));
ec->GetCanvas()->Connect(“ProcessedEvent(Int_t,Int_t,Int_t,TObject*)”, 0, 0, “HandleC2(Int_t,Int_t,Int_t,TObject*)”);

ec = new TRootEmbeddedCanvas(“Ecanvas3”, w, 200, 200);
w->AddFrame(ec, new TGTableLayoutHints(0, 1, 1, 2,
kLHintsExpandX | kLHintsExpandY |
kLHintsShrinkX | kLHintsShrinkY |
kLHintsCenterX | kLHintsCenterY |
kLHintsFillX | kLHintsFillY,
1, 1, 1, 1));
ec->GetCanvas()->Connect(“ProcessedEvent(Int_t,Int_t,Int_t,TObject*)”, 0, 0, “HandleC3(Int_t,Int_t,Int_t,TObject*)”);

ec = new TRootEmbeddedCanvas(“Ecanvas4”, w, 200, 200);
w->AddFrame(ec, new TGTableLayoutHints(1, 2, 1, 2,
kLHintsExpandX | kLHintsExpandY |
kLHintsShrinkX | kLHintsShrinkY |
kLHintsCenterX | kLHintsCenterY |
kLHintsFillX | kLHintsFillY,
1, 1, 1, 1));
ec->GetCanvas()->Connect(“ProcessedEvent(Int_t,Int_t,Int_t,TObject*)”, 0, 0, “HandleC4(Int_t,Int_t,Int_t,TObject*)”);

w->Connect(“CloseWindow()”, “TApplication”, gApplication, “Terminate()”);
w->DontCallClose();

w->SetWindowName(“Example Macro”);
w->MapSubwindows();
w->Resize();
w->Resize(800, 800);
w->MapWindow();
}
[/code]
Could you try and let me know if it works for you?

Cheers, Bertrand.

Hi,

Your example works. But it is a macro. The question was about stadealone code. I did not find the solution with 6 objects of the TRootEmbeddedCanvas and now use one object with TCanvas divided on the 6 parts. It works and enough for my task.
They are used only for the drawing of three 2d projections of the small 3d object and of three 1d projections of the same objects. This small 3d object is a part of the large 3d object and using mouse I can select different parts of the large object. It will use in the analysis of the triple gamma coincidences.

Sincerely Yours and thanks,
Andrey

Hi Andrey,

You’re welcome. But there should be no difference between a macro and compiled (standalone) code… Anyway, I’ll cross-check.

Cheers, Bertrand.