[vtkusers] Resizing vtkSliderRepresentation2D

imran khan khan.imranh at gmail.com
Thu May 20 21:30:48 EDT 2010


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100520/b7be97c4/attachment.htm>


More information about the vtkusers mailing list