<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="-1"><font face="Helvetica, Arial, sans-serif">This is
interesting for me too.<br>
When adding an observer on the render window, how can I limit the
window size to a minimim value inside the callback function?<br>
</font></font><br>
Am 27.03.2010 00:00, schrieb Xiaofeng Z:
<blockquote cite="mid:COL123-DS2097DB59E3FAA59FDEB7BCE5160@phx.gbl"
type="cite">Thanks John, I'll try.
<br>
<br>
Xiaofeng
<br>
<br>
--------------------------------------------------
<br>
From: "John Drescher" <a class="moz-txt-link-rfc2396E" href="mailto:drescherjm@gmail.com"><drescherjm@gmail.com></a>
<br>
Sent: Friday, March 26, 2010 11:00 AM
<br>
To: "Darshan Pai" <a class="moz-txt-link-rfc2396E" href="mailto:darshanpai@gmail.com"><darshanpai@gmail.com></a>
<br>
Cc: "Xiaofeng Z" <a class="moz-txt-link-rfc2396E" href="mailto:xf10036@hotmail.com"><xf10036@hotmail.com></a>; "VTK"
<a class="moz-txt-link-rfc2396E" href="mailto:vtkusers@vtk.org"><vtkusers@vtk.org></a>
<br>
Subject: Re: [vtkusers] How to intercept Window Size Change Event
<br>
<br>
<blockquote type="cite">
<blockquote type="cite">actually the VTK window is already
optimized for window resize . but if you
<br>
using GUI then all you have to do is call the SetSize() of
vtkRenderWindow
<br>
<br>
</blockquote>
<br>
This week I had to do this because for me its optimized in an
<br>
undesirable way. I mean the automatic scale of images is only based on
<br>
the height of the window and does not use the width as a constraint as
<br>
well. For this I added an Observe for the Modified event on the render
<br>
window.
<br>
<br>
<br>
in setupRenderWindow()
<br>
...
<br>
vtkSmartPointer<vtkCallbackCommand> m_pModifiedCallback =
<br>
vtkSmartPointer<vtkCallbackCommand>::New();
<br>
m_pModifiedCallback->SetCallback (WindowModifiedCallback);
<br>
m_pModifiedCallback->SetClientData(this);
<br>
<br>
m_pRenderWindow = vtkSmartPointer<vtkRenderWindow>::New();
<br>
m_pRenderWindow->AddObserver(vtkCommand::ModifiedEvent,m_pModifiedCallback);
<br>
..
<br>
<br>
<br>
Now the callback:
<br>
<br>
<br>
void smImageView::smPrivate::WindowModifiedCallback( vtkObject*
<br>
caller, long unsigned int eventId, void* clientData, void* callData )
<br>
{
<br>
smImageView::smPrivate* pSelf =
<br>
static_cast<smImageView::smPrivate*>(clientData);
<br>
pSelf->updateCameraScaleBasedOnWindowSize();
<br>
}
<br>
<br>
<br>
Note this is a static void member function.
<br>
<br>
John
<br>
<br>
</blockquote>
_______________________________________________
<br>
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
<br>
<br>
Visit other Kitware open-source projects at
<a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
<br>
<br>
Please keep messages on-topic and check the VTK FAQ at:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>
<br>
<br>
Follow this link to subscribe/unsubscribe:
<br>
<a class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>
<br>
<br>
</blockquote>
</body>
</html>