EVE : drag and drop problem

Hello,

I think that I found a problem with the drag and drop with EVE. I attached a modified version of test_histobrowser.C which shows it. The problem is when trying to find primitives of gpad after a drop.
The modification I did in the tutorial is just adding a method call in the Clear macro in order to print the pad address and its primitives.

To reproduce :

  1. launch test_histobrowser.C
  2. double click the “split” macro
  3. double click an histogram
  4. select the main canvas, not the pads (by dragging something on the space between the pads, and then coming back to the tree per instance)
  5. double click the “clear” macro
    ==> the output is
    pad : 0xyyyyyyy
    primitives : TPad ; TPad ; TPad ; TPad ;
    ==> this is correct

Now lets do it by dragging and dropping the macro “clear” :

  1. launch test_histobrowser.C
  2. double click the “split” macro
  3. double click an histogram
  4. drag and drop the “clear” macro on the main canvas, not the pads
    ==>the output is
    pad : 0xyyyyyyy
    primitives : TMacro ;
    ==> this is wrong, isn’t it ? ? ?
    I think that it should clearly behave like the first time with double clicking the macro. What is very strange is that the pad is the same.

What do you think ?

Thanks in advance for the feedback and your help,

Barth
test_histobrowser.C (2.03 KB)

Hi Barth,

If you drag and drop a TMacro inside a canvas, what else would you expect? (even if I agree it doesn’t make much sense to add a TMacro in the list of primitives…)

Cheers,
Bertrand.

Bertrand,

Adding a TMacro to the list of primitives makes sense. When repainting the scene teh macro is executed. Quite powerful!

Rene

Ooops! :blush: OK, good point!
Bath, I guess you have your answer now :wink:

Cheers, Bertrand.

Hi,

Thanks for your replies. I can understand why the TMacro is added to the primitives, but not why the list of primitives doesn’t contain the other primitives, ak the TPad’s. Maybe am I missunderstanding the notion of “primitive” but I thought it was any element contained in the TPad.

Anyway, this leads me to another question : In the example I gave, and if it is normal not to have references to the sub pads in the primitives, how could I get the references to the sub pad(s) ? Is there any correct and simple way ?
I am thinking of using “cd” until I get a null reference…

Thanks,

Barth

A TPlad is a collection of drawable elements (ie objects that have a Paint function).
This is the case for basic primitives like lines, text, graphs, histograms, for TExec objects (A TExec::Paint executes the macro), but also TPads. TPad::Paint paint itself, including its list of primitives that may include other TPads.

Rene

Ok, thanks, it is more or less what I thought. And it makes things clearer ! :slight_smile:

But that doesn’t explain why, in the example I sent before, the list of primitives of the TCanvas (gPad in this case) doesn’t have both the TMacro (dropped on the TCanvas and triggering the method call looking at the primitives) and the sub pads (which are inside the TCanvas).

Thanks

Barth

Hi Barth,

[quote]But that doesn’t explain why, in the example I sent before, the list of primitives of the TCanvas (gPad in this case) doesn’t have both the TMacro (dropped on the TCanvas and triggering the method call looking at the primitives) and the sub pads (which are inside the TCanvas).
[/quote]
Because the macro “Clear Canvas” actually clears the canvas (remove sub-pads)…
If you drag and drop the “Split Canvas” into the cleared Canvas, it will be divided again, and you will see:

pad : 1 primitives : TMacro ; TPad ; TPad ; TPad ; TPad ;
Cheers,
Bertrand.