I found a bug which drives me crazy. When OCC is used in a dialog as a control (as found in the example HLR) it shows a weird behaviour:
1) The background of the dialog window is not painted correctly
2) On some systems (and I cannot say under what circumstances) the controls is completely black. This does not depend on the OS Version !
I found a workaround for the bug, which is as follows:
Save the Windowproc before you create the WNT_Window and restore it afterwards to the original value:
// Save the window proc pointer
LONG WndProc = GetWindowLong(GetSafeHwnd(), GWL_WNDPROC);
Handle(WNT_Window) aWNTWindow =
new WNT_Window(theGraphicDevice, GetSafeHwnd());
if (!aWNTWindow->IsMapped())
aWNTWindow->Map();
m_View->SetWindow(aWNTWindow);
// restore it to the original value
SetWindowLong(GetSafeHwnd(), GWL_WNDPROC, WndProc);
Unfortunately this does not solve my second problem, which makes OpenCascade unusable in dialog windows :-)
I'm sorry but I can't test it: The executable install has an unresolved external "angular_precision" in TKMath.dll (what version of OCC are you using?) and the source code does not compile here (a lot of compile errors). I use the latest public OCC release.
If you still have problems, I can send you the "new" one compiled with 5.1
HTH,
Commenter-1
PS : for the problems running exoTKAD, mail me directly : [email removed]
04Author
The first part of my problem report seems to be solved: Do not use the MFC function "DDX_Control" to bind a control to an OCC window. Use "CWnd::Create()" instead and take only the coordinates from a control in a window. The OnPaint() function of your control shall look like this:
void COccControl::OnPaint()
{
CPaintDC dc(this); // important !!!
if (!m_View.IsNull())
m_View->Redraw();
}
The second part of the problem is still under my investigation.