I have a problem with my GUI. I have a class which derives from TGMainFrame and at one time I am creating a canvas like this:
which is not embedded in the GUI. Everything is working, the canvas is created, however when I am closing it with the cross, all my GUI is closed… I tried to disconnect the closed signal of the canvas, but I have still the same problem. I am compiling my code with a makefile, and I am using Root 5.24. Maybe I cannot create a canvas like this in a GUI…
There is no problem at all creating a TCanvas from a GUI application. The problem should be somewhere else… Is your application closing properly, or do you have any error message? Can you put a break point to see who is closing your MainFrame or your application?
I have no error message unfortunately… In my constructor I have these two lines, do you think the problem can come from there?
[quote]this->Connect(“TGMainFrame”, “CloseWindow()”, “TApplication”, gApplication, “Terminate()”); //To quit the application
What do you mean by break point? Because I do not know if it is the canvas which is closing the application, or the application which is closed and then delete the canvas…
If you want to use the CloseWindow() signal, here is the correct syntax:
Connect("CloseWindow()", "TApplication", gApplication, "Terminate()");(note the this-> is not needed…)
With your actual syntax you are connecting any TGMainframe::CloseWindow() to gApplication->Terminate()
And I meant to put a break point in your favorite debugger
Thank you, it works now without the “TGMainFrame”, in fact I was connecting the canvas created in this class I think.