[vtk-developers] Re: GUISupport directory ?
de Boer Ingo
I.deBoer at polytec.de
Tue Feb 15 07:31:13 EST 2005
> For a dialog it is mot much different from the MDI and SDI
> examples, except you have to use the PreTranslateMessage if
> you want keyboard interaction.
Yeah, but you can also use the WindowProc function.
But all of this cannot be handled from the generic window class.
It has to be handled from the dialog app. So you have double
code anyway. It is easier to write the code once without the
generic window class.
> I didn't. I realize they were there in the bug tracker when
> I took this code from the already existing examples and modified it.
I think the existing ones are no good.
Eg, the pipeline is executed always in the OnDraw, which is not needed.
I tried to compile the samples with VTK_BUILD_SHARED_LIBS which did not
You should give my samples a try. There is a MDI,SDI and dialogbased
sample (without a generic mfc-vtk window class)
> We have an MDI and SDI sample already that uses this new
> class. Do you want to try it in a dialog?
I tried it by modifying my sample. But I did not succeed.
I only got a high cpu level, not knowing why.
Also, I was not able to move the object, which means, that
the windowproc didn't get through.
What you do is, that you have to make a frame object on your
dialog, get the window from it and make it parent to the
> The OnPaint function doesn't pass in a CDC to do printing
> like that. It is the OnDraw functions from CView that has that.
> I don't think CWnd has an OnDraw function.
This is another reason why I wouldn't suggest a generic window
class. I would like to mention some points:
1. If I have a window class, I want to derive it, not use it as a child.
2. All the vtk classes come with eg: this->ren = vtkRenderer::New();
The generic mfc window comes with vtkWindow = new vtkMFCWindow;
Novice uses might stumble about this.
3. When you do the render call in OnPaint, how to you do the printing ?
You do that in OnDraw, which is called from OnPaint, so you render
although you print, because the vtkMFCWindow::OnPaint is called
every time. So too much calls here ?
4. One should keep it simple.
When you write your own program, you do not use the generic window.
Simply because, why should you use an extra class with a few lines
in your own code. You have to make the whole scene setup anyway in
your own class.
Just some thoughts...
Dr.-Ing. Ingo H. de Boer
Polytec-Platz 1-7, 76337 Waldbronn, Germany
phone: ++49 7243 604 106
fax : ++49 7243 604 255
More information about the vtk-developers