DiscussionsIssue archiveOCCT:Visualization

Archived issue #0032532

Multiple Views using "WNT_Window" in MFC Dialog

CommunityOCCT:Visualizationclosed9 public notes

Search issues

Description

Hello,

I have created three "3d_views" in a MFC dialog using following code:

  Viewer_1 = new V3d_Viewer(GraphicDriver);
  Viewer_2 = new V3d_Viewer(GraphicDriver);
  Viewer_3 = new V3d_Viewer(GraphicDriver);

  Window_1 = new WNT_Window(GetSafeHwnd());
  Window_2 = new WNT_Window(GetSafeHwnd());
  Window_3 = new WNT_Window(GetSafeHwnd());

  View_1 = Viewer_1->CreateView();
  View_2 = Viewer_2->CreateView();
  View_3 = Viewer_3->CreateView();

  View_1->SetWindow(Window_1);
  if (!Window_1->IsMapped())
     Window_1->Map();

  View_2->SetWindow(Window_2);
  if (!Window_2->IsMapped())
     Window_2->Map();

  View_3->SetWindow(Window_3);
  if (!Window_3->IsMapped())
     Window_3->Map();


It is working; but while opening a dialog, all three views are not building at a same time. Instead, Window_1 is first created, then Window_2 and then Window_3.
It is giving weird behavior of a dialog. They should build simultaneously.

Also, above code works in "OnPaint()", not in "OnInDialog()."

Is it a flickering issue or anything else?

Public activity

9 archived notes

Participants are labeled by their role within this record.

01Commenter 2
If you would like 3 windows to appear at once, then you should probably setup 3 views (until V3d_View::SetWindow()) and show these windows on the screen afterwards (via WNT_Window::Map() or it's analog in MFC).
02Author
Hello kgv,

Thanks for the reply.

I have done the same here. Is anything missing in the code?

  Viewer_1 = new V3d_Viewer(GraphicDriver);
  Viewer_2 = new V3d_Viewer(GraphicDriver);
  Viewer_3 = new V3d_Viewer(GraphicDriver);

  Window_1 = new WNT_Window(GetSafeHwnd());
  Window_2 = new WNT_Window(GetSafeHwnd());
  Window_3 = new WNT_Window(GetSafeHwnd());

  View_1 = Viewer_1->CreateView();
  View_2 = Viewer_2->CreateView();
  View_3 = Viewer_3->CreateView();

  View_1->SetWindow(Window_1);
  if (!Window_1->IsMapped())
     Window_1->Map();

  View_2->SetWindow(Window_2);
  if (!Window_2->IsMapped())
     Window_2->Map();

  View_3->SetWindow(Window_3);
  if (!Window_3->IsMapped())
     Window_3->Map();
03Commenter 2
You call Map() after SetWindow() individually per view.
What I suggest is calling Map() for 3 windows after all Views have been defined via SetWindow().
04Author
Dear kgv,

I am little bit confused.
could you please show a snippet here?

Because if I remove "Map()" function from the code,
still all three windows are displaying.
05Commenter 2
This means that windows have been already displayed by MFC logic - you may try adjusting visibility of these 3 windows somewhere there.

Note that V3d_View performs implicit window redraws in many places like V3d_View::SetWindow() or V3d_View::MustBeResized().
This behavior could be disabled by V3d_View::SetImmediateUpdate() flag (normally set right after V3d_View construction).
06Author
Thanks kgv. I got your point.
In V3d_View.cxx/SetWindow(), Redraw() has been called.

"SetImmediateUpdate(FALSE)" doesn't work.

Any other idea??
07Commenter 2
> "SetImmediateUpdate(FALSE)" doesn't work.
If you are indeed using OCCT 7.2.0, then you need updating OCCT to a newer version (7.4.0+), where this particular bug in V3d_View::SetWindow() has been fixed.
08Author
Thanks... I will do it.
09Author
Thanks kgv for help.
Issue is resolved by updating OCCT version.

Related records