[ROOT] Problem with TRootCanvas::Connect

From: Dr. D. Sideris (d.sideris@ic.ac.uk)
Date: Thu Feb 22 2001 - 15:30:08 MET


Dear Rooters, I have tried to implement a example by Fons Rademakers, on how to control the closing of a canvas window. My code segment looks like this:

bool Global::CanvasOpen(char* name, char* title, Int_t dx, Int_t dy)
{
   if (!rootapp) rootapp = new TApplication("EVA", 0, 0);
  
  c = new TCanvas(name,title,dx,dy);

/* have added this: */
  rc = (TRootCanvas*)c->GetCanvasImp();
  rc->Connect("CloseWindow()", 0, 0, "monitorClose()");   //Crashes here


 
  return 0;
}



void monitorClose()
{
 // todo
}




This was working fine without the rc->... statements. When I try to open a Canvas the application crashes at the indicated statement (rc is previously declared as TRootCanvas*). The message of the debugger is: 

Unhandeled access violation in evamfc2.exe (LIBCORE.DLL): 0xC0000005: Access Violation

Note that I'm using root and mfc in a VC++6 environment.

Any suggestions?

Dimitris



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:37 MET