Is there a simple way to block the ‘Closed()’ signal of TCanvas? My purpose is protecting Canvas being closed by the ‘Close’ button on the up-right corner.
I know a method for this purpose is connect the ‘Closed()’ signal to a user slot (such as can->Connect(“Closed()”,“MTree”,this,“ClosedCanvas()”);). However this way is not good for me, because I used the ‘ProcessMessage()’ method to implement my program.
The ‘BlockAllSignals()’ method of ‘TCanvas’ is also not good, because it disabled the ‘MenuBar’ signals also.
Is there some other ways?
Any reply is appreciated.
You can avoid closing the canvas by calling the DontCallClose() method, but then, it is up to you to close it. The code would look like this:
Another solution could be to tell the window manager to not close the canvas:
kMWMFuncResize | kMWMFuncMaximize | kMWMFuncMinimize | kMWMFuncMove,
But as it is highly WM (window manager) dependent, this may not work (e.g. it does not work on Windows)
Thank you very much.
I choose the first method, it works well under both Windows and Linux.