How to judge a window is closed or not?

Hi, I have two questions:

  1. In the MyMainframe class, I create a SetDiag:
    fSetDiag = new SetDiag(fClient->GetRoot(),400,200);
    and then I write:
    if(fSetDiag!=NULL) fSetDiag->Refresh();

I found that if I close the fSetDiag, the fSetDiag is not set to NULL, then segmentation violation. Any suggestions?

  1. If I want the fSetDiag window is always on the top of the windows, how to do that?


  1. With no real example and information what kind of classes are SetDiag and MyMainframe I could only suggest: the easiest way will be if your class SetDiag emits a signal “Closed()”. You can connect then a method of MyMainframe class to this signal and set fSetDiag=0 there. Do not forget to disconnect from this signal before setting to 0 and to connect again if you create a new one in MyMainframe class.

  2. You can use:gVirtualX->RaiseWindow(fSetDiag->GetId());presuming SetDiag is a TGObject by some inheritance.

Cheers, Ilka

Thanks, that’s exactly what I want!