[vtk-developers] BUG: SetWindowName() for vtkWin32OpenGLRenderWindow

Lloyd, David Brandon dblloyd at sandia.gov
Tue Jun 21 13:08:11 EDT 2005


If you set the window name in Windows before the the window is actually
created, the name is obliterated. For example, the following code
fragment produces a window with the name "Visualization Toolkit -
Win32OpenGL #1":

	vtkRenderWindow* renWin = vtkRenderWindow::New();
	renWin->SetWindowName( "My Window Name" );

	...

	renWin->Render();

	// window has wrong title

If you instead set the window name after the window has been created,
the name will be set properly:

	vtkRenderWindow* renWin = vtkRenderWindow::New();

	...

	renWin->Render();
	renWin->SetWindowName( "My Window Name" );

	//window has correct title

The problem lies in vtkWin32OpenGLRenderWindow::CreateAWindow(). Here
the title of the window is set without regard to the current value of
the WindowName member variable. 

To fix the problem I suggest setting the WindowName to "Visualization
Toolkit - Win32OpenGL #" in the constructor. When CreateAWindow() is
called, if WindowName has not been changed then append the number of
this window to the WindowName as is done currently. Otherwise, leave the
name as it is. 

Are there any objections to this fix or better suggestions?

Brandon Lloyd

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20050621/0003e09d/attachment.html>


More information about the vtk-developers mailing list