[vtkusers] Resizing vtkSliderRepresentation2D

Karthik Krishnan karthik.krishnan at kitware.com
Fri May 21 12:08:54 EDT 2010


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




On Fri, May 21, 2010 at 9:16 PM, Eric E. Monson <emonson at cs.duke.edu> wrote:

> Hey Imran,
>
> Thanks for passing this along -- I've been having the same problem.
>
> I hope you're right that there is a more proper solution out there
> somewhere, but it's nice to know that this works for now.
>
> Talk to you later,
> -Eric
>
> ------------------------------------------------------
> Eric E Monson
> Duke Visualization Technology Group
>
>
> On May 20, 2010, at 9:30 PM, imran khan wrote:
>
> > I have figured out a hack to resize 2D widgets when the window resizes. I
> am sure that there is
> > a better way to do it, but unfortunately no one responded to my earlier
> query.
> >
> > In your resize window handler function, add the following code
> >
> > char TestLineWidgetEventLog[] =
> > "# StreamVersion 1\n"
> > "MiddleButtonPressEvent 148 150 0 0 0 0 i\n"
> > "MiddleButtonReleaseEvent 136 150 0 0 0 0 i\n"
> > ;
> >
> > void CYourView::OnSize(UINT nType, int cx, int cy)
> >     {
> >     ....
> >          // play a short sequence of events. A hack to get widget to
> resize
> >         recorder = vtkInteractorEventRecorder::New();
> >         recorder->SetInteractor(Interactor);
> >         recorder->ReadFromInputStringOn();
> >         recorder->SetInputString(TestLineWidgetEventLog);
> >         recorder->Play();
> >         recorder->Off();
> >         recorder->Delete();
> >         }
> >     }
> >
> >
> > This will actually resize all the widgets in your window
> >
> > Cheers,
> >
> > Imran
> > _______________________________________________
> > 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
>
> _______________________________________________
> 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/e3f58560/attachment.htm>


More information about the vtkusers mailing list