I'm missing the point here. The SliderWidget is (internally) composed of vtkActor2D's and *does automatically* resize to the size of the render window. ie, its length maintains a constant ratio w.r.t the render window's size along that axis.<br>
<br>You can ascertain this by running the test TestSliderWidget2D and resizing the render window.<br><br> $ ./bin/WidgetsCxxTests TestSliderWidget2D -D /home/karthik/VTKData -V Baseline/Widgets/TestSliderWidget2D.png -I <br>
<br><br>If you do *not* want it to maintain a fixed ration with respect , you can use the Point1 and Point2 coordinates; or override the SliderRepresentation and add your logic to the BuildRepresentation() method.<br><br>
Thanks<br>--<br>karthik<br><br><div class="gmail_quote">On Thu, May 27, 2010 at 6:35 PM, imran khan <span dir="ltr"><<a href="mailto:khan.imranh@gmail.com">khan.imranh@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
This is a better solution than mine. Although there should ideally be something more<br>evident in the design to implement resizing of widget representations for adjusting to<br>resize of window.<br><br>Thanks for this.<br>
<font color="#888888">
<br>Imran</font><div><div></div><div class="h5"><br><br><br><div class="gmail_quote">On Fri, May 21, 2010 at 1:34 PM, Eric E. Monson <span dir="ltr"><<a href="mailto:emonson@cs.duke.edu" target="_blank">emonson@cs.duke.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style="">Okay, I was able to finally get this to work. Instead of calling Render on the slider widget, it updates properly if I call<div><br></div><div>sliderRep.Modified()</div><div><br></div><div>
after I change those point coordinates and before I call Render() on the render window.</div><div><br></div><div>I'm not sure exactly how this can help in your situation, Imran...</div><div><br></div><div>-Eric</div>
<div>
<br><div><div><div></div><div><div>On May 21, 2010, at 1:16 PM, Eric E. Monson wrote:</div><br></div></div><blockquote type="cite"><div><div></div><div><div style="">The other place where I run into trouble with this issue is when I try to change the size/placement of the widget. I make calls like this (sliderRep is an instance of vtkSliderRepresentation2D, python code):<div>
<br></div><div><div>sliderRep.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()</div><div>sliderRep.GetPoint1Coordinate().SetValue(0.1 ,0.07)</div><div>sliderRep.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()</div>
<div>sliderRep.GetPoint2Coordinate().SetValue(0.9, 0.07)</div><div><br></div><div>but even after trying the naive methods of re-rendering the widget and window:</div><div><br></div><div><div>sliderWidget.Render()</div><div>
renderWindow.Render()</div><div><br></div><div>the position of the slider isn't updated until I interact with the window.</div><div><br></div><div>-Eric</div><div><br></div></div><div><div>On May 21, 2010, at 12:41 PM, imran khan wrote:</div>
<br><blockquote type="cite">Karthik:<br><br>The issue is that the widget maintains its absolute size when the window is resized. It sizes up correctly when<br>a mouse interaction happens within the rendered area. So what my hack is doing is mimicking a middle button<br>
press which indirectly resizes the widgets correctly.<br><br>It is not clear what changing the Point1Coordinate and a Point2Coordinate in normalized coordinates would do. As<br>I want to maintain the same normalized locations when the window resizes.<br>
<br>Imran<br><br><div class="gmail_quote">On Fri, May 21, 2010 at 12:08 PM, Karthik Krishnan <span dir="ltr"><<a href="mailto:karthik.krishnan@kitware.com" target="_blank">karthik.krishnan@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I'm not sure what that code snippet does, but this is totally not the right way to resize any widget. <br><br>The slider representation has a Point1Coordinate and a Point2Coordinate. These define the end points of the slider (in normlized coordinates [-1, 1]). These iVars just aren't exposed. Modify the code yourself (or derive from vtkSliderRepresentation2D) and expose them so as to resize the widget.<br>
<br>Thanks<br>--<br><font color="#888888">karthik</font><div><div></div><div><br><br><br><br></div></div></blockquote></div>
</blockquote></div><br></div></div></div></div><div>_______________________________________________<br>Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br><br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</div></blockquote></div><br></div></div></blockquote></div><br>
</div></div></blockquote></div><br><br clear="all"><br><br>