2

How can I hide vtkOutputWindow? No suppress by GlobalWarningDisplayOff() or redirect output to file but only hide. (And show again after some time via something like vtkOutputWindow::GetInstance()->DisplayText(" ")). Thanks.

PS. I use Qt gui on Windows.

PPS. For those who are interested in this question I bring here mailing list correspondence (hiperlink not yet available):

Bel,Ok! Now I see what you meant. As you said, probably the easiest way to do that would be sending a close signal to the window.

As you can see on vtkWin32OutputWindow reference (https://www.vtk.org/doc/nightly/html/classvtkWin32OutputWindow.html) it is "a read only EDIT control", so if you could get its handle maybe you would be able to incorporate it to a window that you have control of. Another, more complex, solution would be to create a new class that would inherit from vtkOutputWindow, based on vtkWin32OutputWindow but with controls to hide and show the control. Best regards, Lucas Frucht Desenvolvimento

Lucas, thanks for reply. I don't need to "save changes" while vtkOutputWindow is hidden. In generally my question is about how to hide/show this window from gui in runtime. vtkOutputWindow class is not derived from any widget so it havn't any method like "hide" or "close". Also destroy it not help too.

vtkOutputWindow *w =  vtkOutputWindow::GetInstance();
w->Delete();
... (redirecting...) 

don't close it. It seem to sending close signal to window is the simplest solution.

Sincerely, Bel. 08.08.2018 18:04, lucas.frucht@medilabsistemas.com.br: >

Bel, There is one point that is not clear to me in your question. Do you want the messages that would have been shown when vtkOutputWindow is hidden to be discarded or to be shown when you unhide it?

If you want it to be discarded, I suppose you could redirect it to /dev/null on Unix or to nul on Windows and delete the redirection when you want to unhide the window.

If you just want to delay the output, maybe, you could redirect the messages to an vtkStringOutputWindow to store the messages on a string and when you want to show then, delete the redirection and call DisplayText passing the string where you stored the messages. I never tried this, but it seems reasonable to me. Best regards, Lucas Frucht.

Bleach
  • 156
  • 3
  • 15

1 Answers1

0

On Windows, this will maybe work (I haven't tested it though).

vtkSmartPointer<vtkWin32OutputWindow> outputWindow = vtkSmartPointer<vtkWin32OutputWindow>::New(); 
outputWindow->SetSendToStdErr(true);
vtkOutputWindow::SetInstance(outputWindow);

The output messages will be directed to stderr instead of the output window. To turn it on again, disable the redirection. Other possibilities include subclassing of vtkOutputWindow or to install an observer for error events that do what you need.

A similar question was posted here.

normanius
  • 8,629
  • 7
  • 53
  • 83
  • 1
    Thanks, but this not hide (close) window. To make it clearer what I meant I copied reply from correspondences to question. – Bleach Aug 09 '18 at 01:27
  • Have you tried to subclass `vtkOutputWindow`? Have a look at the source of [`vtkWin32OutputWindow`](https://github.com/Kitware/VTK/blob/master/Common/Core/vtkWin32OutputWindow.cxx) for an idea. You could add `hide()` and `show()` methods yourself. – normanius Aug 09 '18 at 09:25
  • > Have a look at the source – Bleach Aug 09 '18 at 19:15
  • > Have a look at the source of vtkWin32OutputWindow for an idea - yes, look like subclass inherited from OutputWindow with hide method (show we can by `vtkOutputWindow::GetInstance()->DisplayText(" ")`) resolve this. But I not try it because we decide left it to user. – Bleach Aug 09 '18 at 19:25