[vtkusers] Resizing vtkSliderRepresentation2D

Eric E. Monson emonson at cs.duke.edu
Fri May 21 13:16:46 EDT 2010


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
> 
> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100521/ec883844/attachment.htm>


More information about the vtkusers mailing list