Why isn't it allowed to reassign a window to a V3d_View?

When V3d_View::SetWindow (const Handle &IdWin) is called a second time on a view, an exception is thrown.

Documentation says:

Activates the view in the window specified and Map the Window to the screen.
//! Warning! raises MultiplyDefined from Standard if the view is already activated in a window.

Is there a way to disconnect the window from the view?
If not, I would like to understand more the reason behind it.

In my case, I'm using the view with docking. When the window is docked or undocked, the window handle changes. So, I have to create a new window and I would like to assign it to the existing V3d_View.
I know, I can create a new V3d_View instead and assign the window to it, but I don't understand why this is necessary and I had also some problems with it because the default view mapping changes if the view was scaled.


Timo Roth's picture

I saw that in OCC 6.8.0 there is the following change:

0025422: Visualization, TKOpenGl - support re-assignment of new window to existing View

Does this work only for Android or also on MS Windows?


Forum supervisor's picture

Dear Timo,
The API modification itself has been done in general-purpose manner.
The bug title highlights Android because the problem comes critical for this platform due to design specificities of OS,
while on other platforms there is usually no need for such manipulations at all.

Re-assignment should work well on other systems, but has not been tested.
It should be noted, that new window should be really new (to assign Pixel Format and create new OpenGL context) or with externally managed OpenGL context (using appropriate V3d_View methods).
Best regards