Pad refresh

Dear Rooters,

I’m trying to update code written using ROOT 3.05/07 to ROOT 3.10/01, but I’m having trouble getting the canvases to refresh. If I minimize the canvas, or drag another window on top of it, the pads on the canvas do not refresh. Additionally, the graphs on the canvas cannot be edited (SetEditable() is set to TRUE). After creating the graphs, I update them using c1->Update() and gPad->Update().
The code works, unaltered, in version 3.05/07. Any suggestions?

Thanks,
Jason

Hi,
which platform you are using?

Regards. Valeriy

I am using Windows XP with MS Visual Studio .NET 2003.

Here is an example of the code I use to create the canvas:
{
TApplication theApp(“App”, &argc, argv);
canvas = new TCanvas(c_table->canvas_name, c_table->canvas_title, c_table->xpos + (N_obj-1)*300,
c_table->ypos,
c_table->width,
c_table->height );
canvas->Divide(1, c_table->ngraphs);

 canvas->cd(3);
 apgr[2] = new TGraph(n_pts, dp_chan, npdiff);
 apgr[2]->SetEditable(false);
 apgr[2]->Draw("ALP");
 canvas->cd();
 canvas->Update();	
 gPad->Update();

}

Also, when this code is run, the menu bar is not created on the window. All of the canvases and graphs I have created in the root interactive mode work fine.

Cheers,
Jason

win32gdk?

Yes, win32gdk version (installed from root_v3.10.01.win32gdk.tar)

Hi Jason,

Try to add theApp.Run(); at the end of your code, just to see what appens… :wink:

Bertrand.

do not forget to add a comment :smiley: // ROOT(win32gdk) is great!

Hello, I’m having the same problem with 3.10/01 (i.e. no update/refresh/zoom) in canvas/histograms etc created in compiled code. This is under win32gdk.

Anyone figured it out yet?

Thanks
Brandon

Please send teh shortest possible file reproducing your problem.

Rene

Here’s a simple code snippet to show what I’m talking about.

I’d like to note that I’m not sure if this is really a bug since it may be that the new design has the requirement of using an event loop for all applications. (I haven’t gone back and re-read the docs about it).

My complaint would be that requireing all pre-compiled code (non-macro that is) to have a TApplication::Run method defined so as to allow for the event loop as TRint etc have is a rather constrained model for programming. It was always nice in the previous library to be able to throw up a TCavas from within other libraries and plot some quantities. With the current build, this doesn’t seem possible.

Brandon

================= code below ================
#include “TCanvas.h”
#include “TH1.h”

int main(int argc, char** argv)
{
TApplication theApp(“TestGUI”,&argc,argv);

TCanvas c1("c1","c1",400,400);
TH1F hist1("hist1","hist1",100,0,100);
hist1.Fill(10);
hist1.Fill(20);
hist1.Fill(20);
hist1.Draw();
c1.Update();

//effect a pause - no refreshing at this point
getchar();

TCanvas c2("c2","c2",400,400);
TH1F hist2("hist2","hist2",100,0,100);
hist2.Fill(20);
hist2.Fill(30);
hist2.Fill(30);
hist2.Draw();
c2.Update();

//effect a pause - no refreshing at this point
getchar();

//refreshing works from here on.
theApp.Run();

            return 0;

}

Hello,

Well, adding “theApp.Run()” to the end of the code block allowed the canvases to refresh (thanks, Bertrand). Unfortunately, it also prevents me from interacting with my GUI while the application is running.

I think this might be a good example of what Brandon comments on in the previous post:

"My complaint would be that requireing all pre-compiled code (non-macro that is) to have a TApplication::Run method defined so as to allow for the event loop as TRint etc have is a rather constrained model for programming. It was always nice in the previous library to be able to throw up a TCavas from within other libraries and plot some quantities. With the current build, this doesn’t seem possible. "

Thanks again for your help.

Cheers,
Jason

I wonder if the same problem being reported here is related to my 3-Dec post at bottom? I have not tried to add calls to TApplication::Run() as I was told its no longer necessary. I am usin win32gdk

There seems to be a bit of silence on this issue. Would any of the ‘powers that be’ care to comment on this thread as to whether we can expect the same functionality we had in the win32 configuration with the win32gdk?

Thanks

Brandon

Hi Brandon,
be patient please 8)
We worked on it. Seems this problem is solved now.
Check the latest CVS (or wait for next week release).

Regards. Valeriy

Hi Valery,

I’ve gotten the latest CVS, however the problem still seems to be present. I’ll check with the newer release when it comes out.

:slight_smile:

Brandon

Hi Brandon,
what is “the latest CVS”?
I can run without any problem the code you posted previously.

Regards. Valeriy

The ‘latest CVS’ means as of the time I posted. I’ve even tried with the CVS from Thursday Dec. 18th. Still no luck. The test application only begins refreshing the canvases after theApp->Run(); is called. Not before.

Note: this was tested by doing a cvs update, followed by a make distclean and make.

I assume this is all that is required to make sure there are no stale libs hanging around?

Regards,
Brandon

Hi Brandon,
current win32gdk ROOT runs
in the same way as on linux.
I’ll try to describe it below:

… let’s run a progam …

#include “TCanvas.h”
#include “TH1.h”

int main(int argc, char** argv)
{
TApplication theApp(“TestGUI”,&argc,argv);

TCanvas c1(“c1”,“c1”,400,400);
TH1F hist1(“hist1”,“hist1”,100,0,100);
hist1.Fill(10);
hist1.Fill(20);
hist1.Fill(20);
hist1.Draw();
c1.Update();

at that point c1 canvas is drawn and “updated”.
You can see hist1 drawn in canvas.


//effect a pause - no refreshing at this point
getchar();


because of getchar() application doesn’t run and waits
for an input from console

… after pressing a key on keyboard application resumes …

TCanvas c2(“c2”,“c2”,400,400);
TH1F hist2(“hist2”,“hist2”,100,0,100);
hist2.Fill(20);
hist2.Fill(30);
hist2.Fill(30);
hist2.Draw();
c2.Update();

the second canvas is appeared with hist2 drawn.

… after pressing a key on keyboard application goes on …

//refreshing works from here on.
theApp.Run();

… now TApplication event loop started.
You can start graphics interaction from here, e.g.
“edit canvas”, “start TBrowser” etc.

As I mentioned this behaviour is “platform independent”.
You can see the same results under linux.

What else? Probably I didn’t not understand yours request, sorry.

Anyway thanks very much and have good holidays! Valeriy

Ok, I understand. This was my original complaint, since it means that you can only use root graphics if you have an application event loop running. In the win32 version (non-GDK), this is not the case. Your canvases refresh without performing the ‘theApp->Run();’ Give it a try. Run the same test app under a win32 build. The canvases refresh when the ‘getchar();’ is done.

This behavior was nice, since it meant I could throw up a graph from any code I was working on. (Note: I’m talking about external compiled code, not scripts run within rint.).

Happy Hols to you too :slight_smile:

Brandon

finally, I understood too :confused:
“Old win32” has “it’s own X-server for each canvas”.
I will think about this idea …

Regards. Valeriy