gVirtualX / TVirtualX instances using CINT

How does this work with CINT? It seems that a TVirtualX instance is created and destroyed as needed if you are using CINT, is this correct? Also, greyscale.C does not work by running it from the command line or by executing from CINT (ROOT 5.18/ubuntu) However, if I commented out the gVirtualX section checking for the amount of color planes it does work. In the script, it returns 0 for the color planes.

One other thing, using gVirtualX never seems to pop up when I try autocompletion (although gVirtualPS does), even if a window is already up and active. It seems to me that if you have a pad, canvas or other window open that there should be a TVirtualX instance somewhere, correct? I know I’m not running in batch mode either.

I’ve been trying to find some documentation on this or something in the source code, but I’m having a hard time with it.

[quote=“juice”]How does this work with CINT?[/quote] Which version of ROOT we are speaking about?[quote=“juice”]It seems that a TVirtualX instance is created and destroyed as needed if you are using CINT, is this correct?[/quote]No, it is not. An instance of TVirtualX class is used for the batch processing. For the GUI mode, another class derived from TVirtualX is used. There are several classes for GUI mode. They are TGX11, TGWin32 and TGQt (see root.cern.ch/root/html/TGX11.html ) . I hope the names of the classes explain when each of them is supposed to be instantiated. Each class is instantiated at once. Therefore, it is singleton.[quote=“juice”] Also, greyscale.C does not work by running it from the command line or by executing from CINT (ROOT 5.18/ubuntu) [/quote] The problem has nothing to do with CINT. It is not CINT feature. This is the feature of the ROOT 5.18 and higher. The modern versions of ROOT postpone the non -batch TVirtualX instantiation. In the other words, you invoked the greyscale.C too earlier. Try to create some TCanvas first and then call the same macro from CINT. It should work. [quote=“juice”]However, if I commented out the gVirtualX section checking for the amount of color planes it does work. In the script, it returns 0 for the color planes. [/quote] Yes, this is correct. Instantiation of TCanvas forces the ROOT to activate the GUI implementation of TVirtualX and makes the macro working properly. For example, move the statement TCanvas *c = new TCanvas("grey", "Grey Scale", 500, 500);in front of if (gVirtualX) {to see whether it makes the difference[quote=“juice”]One other thing, using gVirtualX never seems to pop up when I try autocompletion (although gVirtualPS does), even if a window is already up and active. It seems to me that if you have a pad, canvas or other window open that there should be a TVirtualX instance somewhere, correct? I know I’m not running in batch mode either.[/quote]Correct. Since there is the “batch” version of TVirtualX its instance is always around.[quote=“juice”]I’ve been trying to find some documentation on this or something in the source code, but I’m having a hard time with it.[/quote] One does not recommend to use the low level methods provided by this class. One is advised to use TCanvas /TPad instead.