Re: [ROOT] Problem with TRootCanvas::Connect

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Thu Feb 22 2001 - 16:43:17 MET


Hi Dimitris,

  on Windows the CanvasImp and other widgets don't derive from TQObject which
allows the signal/slots.

Cheers, FOns.



> "Dr. D. Sideris" wrote:
> 
> 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
> 

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



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