TCanvas::Closed() not emitted when closing window

Hello,

it seems to me that the TCanvas::Closed() signal is not emitted when the user closes the canvas by clicking on the X button of the window. I receive any other signals (Selected, Destroyed, …) so it’s not an issue with my Connect implementation.

I have a class RootAppManager which derives from TApplication, and the dictionary is generated. I connect it to TCanvas using

TQObject::Connect("TCanvas", "Closed()", "RootAppManager", theApp, "CanvasClosed()")

And the CanvasClosed slot just display a message on screen. This slot never gets called. If I replace “Closed()” with any other signal, I get the CanvasClosed() message when performing the corresponding action.

Hi,
I guess this is connected to this:

Especially to the phrase:
But note that the TCanvas is not destroyed by the GUI anymore (since the GUI doesn’t own the TCanvas). to delete it, you have to explicitly call the destructor (delete)

Anymore means: As of version 6.10.

Cheers
Otto

Hello Otto
Thanks for the answer.I am not sure I see the point of having a signal Closed AND a signal Destroyed then if Closed is emitted only when the canvas is destroyed.A signal for that specific action of closing the window holding the canvas should exist.
Cheers,Alex

EDIT: I read more carefully the link and I am using ROOT 6.11. In the linked thread it is mentioned that this behaviour should have been fixed with in ROOT 6.10. Am I missing something?

HI Alex,
to demonstrate what happens I add little macro,
Run it with:
.L mycanvas.C++
MyCanvas *mc = new MyCanvas()
and close the window with the X of the window manager.
Note:
Before Root 6.10 CloseCanvas() was called at this moment.
Now you need to exploit the signal from the TRootCanvas (TGWindow)

What puzzles me: CloseCanvas() is called twice!!

mycanvas.C (1.1 KB)

Cheers
Otto

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.