TCanvas, multiple root sessions

I have a program with multiple gui windows. By going through the various options on these windows I execute macros in separate root sessions. I would like to create a single TCanvas with the generic gui window and then have the macro files send their output to this canvas. I have been using new root sessions to execute these macros since I lose control to the gui if I run them directly from there.

I guess my question is, can I plot histograms from one root session on a canvas created by a different root session? Or, is there a way to execute a macro from a gui and not have the gui lose its functionality?


Is your GUI based on the ROOT GUI classes?
If yes, it is easy to mage a non-blocking GUI.
The best solution is, of course, to use multiple threads, but this implies
substantial changes in your program. The poor man solution is
to use timers. You can see an example in $ROOTSYS/tutorials/anim.C
or in the test programs like games, tetris, etc.
For example you can run the tutorial anim.C and see the logic with
a simple Timer.
Using Timers, you can execute macros from your gui windows and still
get the control to execute other macros in parallel.
Read the chapter about the GUI about signals and slots.

I cannot give more info without more information from your side.


I am using the root GUI classes.

What I am actually doing is I have an exe that reads in data and creates a TMapFile. With a root macro I look at the data in the TMapFile. The gui I have writes a small text file that tells the macro what plot I want to see. I would like to have the TCanvas open all the time and be able to start and stop the macro that produces the plots any time I want. Right now I start a root session in the background that simply executes my macro, so when I stop the macro, I lose the TCanvas.

I will try the TTimer thing out, but if you have any other suggestions, I would appreciate it.

Thanks for the help.