Quantcast

How to close an open vtk-Window by program-code

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to close an open vtk-Window by program-code

rainer-14

Hi vtkusers,

 

how do I close an open vtkRenderWindow, where the interactive render function was called, by a program-code call? (Win32/64) I did not find a vtkRenderWindow-Close call or something similar.

 

Thanks you’re your hints,

 

Rainer

 


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to close an open vtk-Window by program-code

Alex Malyushytskyy
I guess under closing you mean delete,
 so calling ->Delete() on the pointer?

Alex



On Mon, Jun 7, 2010 at 1:34 AM,  <[hidden email]> wrote:

> Hi vtkusers,
>
>
>
> how do I close an open vtkRenderWindow, where the interactive render
> function was called, by a program-code call? (Win32/64) I did not find a
> vtkRenderWindow-Close call or something similar.
>
>
>
> Thanks you’re your hints,
>
>
>
> Rainer
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to close an open vtk-Window by program-code

David Doria-2
On Mon, Jun 14, 2010 at 10:38 PM, Alex Malyushytskyy
<[hidden email]> wrote:
> I guess under closing you mean delete,
>  so calling ->Delete() on the pointer?
>
> Alex


I tried to make an example that would close the window with a keypress
by deleting the pointer. This doesn't seem to work:

http://www.vtk.org/Wiki/VTK/Examples/Broken/CloseWindow

Thanks,

David
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to close an open vtk-Window by program-code

Bill Lorensen
Try
 iren->SetRenderWindow(NULL);
rather than
iren->GetRenderWindow()->Delete();


Looking at the code for  vtkRenderWindowInteractor::SetRenderWindow()
it looks like deleting the render window is tricky.

Bill

On Wed, Jul 21, 2010 at 11:07 AM, David Doria <[hidden email]> wrote:

> On Mon, Jun 14, 2010 at 10:38 PM, Alex Malyushytskyy
> <[hidden email]> wrote:
>> I guess under closing you mean delete,
>>  so calling ->Delete() on the pointer?
>>
>> Alex
>
>
> I tried to make an example that would close the window with a keypress
> by deleting the pointer. This doesn't seem to work:
>
> http://www.vtk.org/Wiki/VTK/Examples/Broken/CloseWindow
>
> Thanks,
>
> David
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to close an open vtk-Window by program-code

David Doria-2
On Wed, Jul 21, 2010 at 12:08 PM, Bill Lorensen <[hidden email]> wrote:
> Try
>  iren->SetRenderWindow(NULL);
> rather than
> iren->GetRenderWindow()->Delete();

Once SetRenderWindow(NULL) is performed, it crashes as soon as the
window is attempted to be updated.

Rainer - did you ever get this to work?

Alex - was that just a thought that you recommended or have you done
this using Delete()?

David
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to close an open vtk-Window by program-code

Bill Lorensen
SetRenderWindow(NULL)  works for me.

On Wed, Jul 21, 2010 at 12:13 PM, David Doria <[hidden email]> wrote:

> On Wed, Jul 21, 2010 at 12:08 PM, Bill Lorensen <[hidden email]> wrote:
>> Try
>>  iren->SetRenderWindow(NULL);
>> rather than
>> iren->GetRenderWindow()->Delete();
>
> Once SetRenderWindow(NULL) is performed, it crashes as soon as the
> window is attempted to be updated.
>
> Rainer - did you ever get this to work?
>
> Alex - was that just a thought that you recommended or have you done
> this using Delete()?
>
> David
>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to close an open vtk-Window by program-code

André Prins
Dear David & Rainer,

I have had success with calling Finalize() on the RenderWindow. What I
usually do is wrap a RenderWindow and Interactor in a simple
viewer-class, which can be constructed on the stack and which has a
"close" method. In there I simply call window->Finalize(). However I
just tried it on your CloseWindow example... It does close/remove the
window, but the event-loop keeps running.

Regards,
Andre

On Wed, Jul 21, 2010 at 12:17 PM, Bill Lorensen <[hidden email]> wrote:

> SetRenderWindow(NULL)  works for me.
>
> On Wed, Jul 21, 2010 at 12:13 PM, David Doria <[hidden email]> wrote:
>> On Wed, Jul 21, 2010 at 12:08 PM, Bill Lorensen <[hidden email]> wrote:
>>> Try
>>>  iren->SetRenderWindow(NULL);
>>> rather than
>>> iren->GetRenderWindow()->Delete();
>>
>> Once SetRenderWindow(NULL) is performed, it crashes as soon as the
>> window is attempted to be updated.
>>
>> Rainer - did you ever get this to work?
>>
>> Alex - was that just a thought that you recommended or have you done
>> this using Delete()?
>>
>> David
>>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to close an open vtk-Window by program-code

Bill Lorensen
How about: iren->TerminateApp();

TerminateApp() notifies the event loop to exit.

On Wed, Jul 21, 2010 at 12:22 PM, André Prins <[hidden email]> wrote:

> Dear David & Rainer,
>
> I have had success with calling Finalize() on the RenderWindow. What I
> usually do is wrap a RenderWindow and Interactor in a simple
> viewer-class, which can be constructed on the stack and which has a
> "close" method. In there I simply call window->Finalize(). However I
> just tried it on your CloseWindow example... It does close/remove the
> window, but the event-loop keeps running.
>
> Regards,
> Andre
>
> On Wed, Jul 21, 2010 at 12:17 PM, Bill Lorensen <[hidden email]> wrote:
>> SetRenderWindow(NULL)  works for me.
>>
>> On Wed, Jul 21, 2010 at 12:13 PM, David Doria <[hidden email]> wrote:
>>> On Wed, Jul 21, 2010 at 12:08 PM, Bill Lorensen <[hidden email]> wrote:
>>>> Try
>>>>  iren->SetRenderWindow(NULL);
>>>> rather than
>>>> iren->GetRenderWindow()->Delete();
>>>
>>> Once SetRenderWindow(NULL) is performed, it crashes as soon as the
>>> window is attempted to be updated.
>>>
>>> Rainer - did you ever get this to work?
>>>
>>> Alex - was that just a thought that you recommended or have you done
>>> this using Delete()?
>>>
>>> David
>>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to close an open vtk-Window by program-code

André Prins
Dear Bill,

Just a question about the TerminateApp() method. The name suggests
that it will "kill the app". When I look at the implementation of the
vtkWin32RenderWindowInteractor it calls PostQuitMessage( 0 )... does
this kill the thread or the application?

Sometimes I wish to close the vtk-window and then reopen another one.
Will this still work with TerminateApp()

Regards,
Andre

On Wed, Jul 21, 2010 at 1:38 PM, Bill Lorensen <[hidden email]> wrote:

> How about: iren->TerminateApp();
>
> TerminateApp() notifies the event loop to exit.
>
> On Wed, Jul 21, 2010 at 12:22 PM, André Prins <[hidden email]> wrote:
>> Dear David & Rainer,
>>
>> I have had success with calling Finalize() on the RenderWindow. What I
>> usually do is wrap a RenderWindow and Interactor in a simple
>> viewer-class, which can be constructed on the stack and which has a
>> "close" method. In there I simply call window->Finalize(). However I
>> just tried it on your CloseWindow example... It does close/remove the
>> window, but the event-loop keeps running.
>>
>> Regards,
>> Andre
>>
>> On Wed, Jul 21, 2010 at 12:17 PM, Bill Lorensen <[hidden email]> wrote:
>>> SetRenderWindow(NULL)  works for me.
>>>
>>> On Wed, Jul 21, 2010 at 12:13 PM, David Doria <[hidden email]> wrote:
>>>> On Wed, Jul 21, 2010 at 12:08 PM, Bill Lorensen <[hidden email]> wrote:
>>>>> Try
>>>>>  iren->SetRenderWindow(NULL);
>>>>> rather than
>>>>> iren->GetRenderWindow()->Delete();
>>>>
>>>> Once SetRenderWindow(NULL) is performed, it crashes as soon as the
>>>> window is attempted to be updated.
>>>>
>>>> Rainer - did you ever get this to work?
>>>>
>>>> Alex - was that just a thought that you recommended or have you done
>>>> this using Delete()?
>>>>
>>>> David
>>>>
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to close an open vtk-Window by program-code

Bill Lorensen
I don't think that it kills the app. But that may be platform
specific... We'll have to experiment.

Bill

On Wed, Jul 21, 2010 at 2:09 PM, André Prins <[hidden email]> wrote:

> Dear Bill,
>
> Just a question about the TerminateApp() method. The name suggests
> that it will "kill the app". When I look at the implementation of the
> vtkWin32RenderWindowInteractor it calls PostQuitMessage( 0 )... does
> this kill the thread or the application?
>
> Sometimes I wish to close the vtk-window and then reopen another one.
> Will this still work with TerminateApp()
>
> Regards,
> Andre
>
> On Wed, Jul 21, 2010 at 1:38 PM, Bill Lorensen <[hidden email]> wrote:
>> How about: iren->TerminateApp();
>>
>> TerminateApp() notifies the event loop to exit.
>>
>> On Wed, Jul 21, 2010 at 12:22 PM, André Prins <[hidden email]> wrote:
>>> Dear David & Rainer,
>>>
>>> I have had success with calling Finalize() on the RenderWindow. What I
>>> usually do is wrap a RenderWindow and Interactor in a simple
>>> viewer-class, which can be constructed on the stack and which has a
>>> "close" method. In there I simply call window->Finalize(). However I
>>> just tried it on your CloseWindow example... It does close/remove the
>>> window, but the event-loop keeps running.
>>>
>>> Regards,
>>> Andre
>>>
>>> On Wed, Jul 21, 2010 at 12:17 PM, Bill Lorensen <[hidden email]> wrote:
>>>> SetRenderWindow(NULL)  works for me.
>>>>
>>>> On Wed, Jul 21, 2010 at 12:13 PM, David Doria <[hidden email]> wrote:
>>>>> On Wed, Jul 21, 2010 at 12:08 PM, Bill Lorensen <[hidden email]> wrote:
>>>>>> Try
>>>>>>  iren->SetRenderWindow(NULL);
>>>>>> rather than
>>>>>> iren->GetRenderWindow()->Delete();
>>>>>
>>>>> Once SetRenderWindow(NULL) is performed, it crashes as soon as the
>>>>> window is attempted to be updated.
>>>>>
>>>>> Rainer - did you ever get this to work?
>>>>>
>>>>> Alex - was that just a thought that you recommended or have you done
>>>>> this using Delete()?
>>>>>
>>>>> David
>>>>>
>>>> _______________________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>>
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>
>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
Loading...