[vtkusers] Resizing vtkSliderRepresentation2D
Eric E. Monson
emonson at cs.duke.edu
Fri May 21 13:34:14 EDT 2010
Okay, I was able to finally get this to work. Instead of calling Render on the slider widget, it updates properly if I call
sliderRep.Modified()
after I change those point coordinates and before I call Render() on the render window.
I'm not sure exactly how this can help in your situation, Imran...
-Eric
On May 21, 2010, at 1:16 PM, Eric E. Monson wrote:
> 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):
>
> sliderRep.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()
> sliderRep.GetPoint1Coordinate().SetValue(0.1 ,0.07)
> sliderRep.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()
> sliderRep.GetPoint2Coordinate().SetValue(0.9, 0.07)
>
> but even after trying the naive methods of re-rendering the widget and window:
>
> sliderWidget.Render()
> renderWindow.Render()
>
> the position of the slider isn't updated until I interact with the window.
>
> -Eric
>
> On May 21, 2010, at 12:41 PM, imran khan wrote:
>
>> Karthik:
>>
>> The issue is that the widget maintains its absolute size when the window is resized. It sizes up correctly when
>> a mouse interaction happens within the rendered area. So what my hack is doing is mimicking a middle button
>> press which indirectly resizes the widgets correctly.
>>
>> It is not clear what changing the Point1Coordinate and a Point2Coordinate in normalized coordinates would do. As
>> I want to maintain the same normalized locations when the window resizes.
>>
>> Imran
>>
>> On Fri, May 21, 2010 at 12:08 PM, Karthik Krishnan <karthik.krishnan at kitware.com> wrote:
>> I'm not sure what that code snippet does, but this is totally not the right way to resize any widget.
>>
>> 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.
>>
>> Thanks
>> --
>> karthik
>>
>>
>>
>>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100521/771c93e2/attachment.htm>
More information about the vtkusers
mailing list