<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hey Matthias,<div><br></div><div>Really? When I make that change to the interactor I get the second (vtkContextView) window popping up, and when I interact with the main render window the interaction only affects the second window...</div><div><br></div><div>I have a feeling that the RenderWindowControl will have to be modified to allow setting the render window, but I still haven't tried building the .NET wrappers from source, so I can't play around yet. (I also may not be experienced enough in C# to play intelligently...)</div><div><br></div><div>Let me know if you make a breakthrough, and hopefully one of the original developers will chime in.&nbsp;</div><div><br></div><div>Thanks,</div><div>-Eric</div><div><br></div><div><br><div><div>On Feb 24, 2011, at 3:22 AM, Matthias Binninger wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span style="font-family:Verdana"><span style="font-size:12px">Thanks a lot!<br> 
<br> 
I got a little further with it, but not as far as I hoped ...<br> 
<br> 
renwin.GetInteractor().Disable();<br> 
renwin.SetInteractor(view.GetInteractor());<br> 
<br> 
... does the trick and makes it possible to use the chart inside the control, but only if<br> 
<br> 
* I don't use the load event handler but start the chart with a button afterwards<br> 
* I don't do anything crazy like ...<br> 
* * draging some other window over it and switch back to the chart<br> 
* * or moving the chart window to my second screen.<br> 
<br> 
else the chart-only window appears and the original window gets messed up.<br> 
<br> 
My code:<br> 
<br> 
<span style="font-size: 10px;">private void Start()<br> 
{<br> 
&nbsp;&nbsp; &nbsp;const int NUM_POINTS = 100;<br> 
&nbsp;&nbsp; &nbsp;const float INC = 7.5f / (NUM_POINTS - 1);<br> 
<br> 
&nbsp;&nbsp; &nbsp;vtkContextView view = vtkContextView.New();<br> 
<br> 
&nbsp;&nbsp; &nbsp;vtkRenderWindow renwin = renderWindowControl1.RenderWindow;<br> 
<br> 
&nbsp;&nbsp; &nbsp;renwin.RemoveRenderer(renwin.GetRenderers().GetFirstRenderer());<br> 
&nbsp;&nbsp; &nbsp;renwin.AddRenderer(view.GetRenderer());<br> 
<br> 
&nbsp;&nbsp; &nbsp;renwin.GetInteractor().Disable();<br> 
&nbsp;&nbsp; &nbsp;renwin.SetInteractor(view.GetInteractor());<br> 
&nbsp;&nbsp; &nbsp;<br> 
&nbsp;&nbsp; &nbsp;view.GetRenderer().SetBackground(1.0, 1.0, 1.0);<br> 
<br> 
&nbsp;&nbsp; &nbsp;vtkChartXY chart = vtkChartXY.New();<br> 
&nbsp;&nbsp; &nbsp;chart.SetTitle("MyChart");<br> 
&nbsp;&nbsp; &nbsp;chart.SetShowLegend(true);<br> 
&nbsp;&nbsp; &nbsp;chart.GetAxis(0).SetTitle("Y");<br> 
&nbsp;&nbsp; &nbsp;chart.GetAxis(1).SetTitle("X");<br> 
<br> 
&nbsp;&nbsp; &nbsp;view.GetScene().AddItem(chart);<br> 
<br> 
&nbsp;&nbsp; &nbsp;vtkTable table = vtkTable.New();<br> 
<br> 
&nbsp;&nbsp; &nbsp;vtkFloatArray arrX = vtkFloatArray.New();<br> 
&nbsp;&nbsp; &nbsp;arrX.SetName("X");<br> 
&nbsp;&nbsp; &nbsp;table.AddColumn(arrX);<br> 
<br> 
&nbsp;&nbsp; &nbsp;vtkFloatArray arrS = vtkFloatArray.New();<br> 
&nbsp;&nbsp; &nbsp;arrS.SetName("Sine");<br> 
&nbsp;&nbsp; &nbsp;table.AddColumn(arrS);<br> 
<br> 
&nbsp;&nbsp; &nbsp;vtkFloatArray arrC = vtkFloatArray.New();<br> 
&nbsp;&nbsp; &nbsp;arrC.SetName("Cosine");<br> 
&nbsp;&nbsp; &nbsp;table.AddColumn(arrC);<br> 
<br> 
&nbsp;&nbsp; &nbsp;table.SetNumberOfRows(NUM_POINTS);<br> 
<br> 
&nbsp;&nbsp; &nbsp;for (int i = 0; i &lt; NUM_POINTS; i++)<br> 
&nbsp;&nbsp; &nbsp;{<br> 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; arrX.SetValue(i, i * INC);<br> 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; arrS.SetValue(i, (float)Math.Sin(i * INC));<br> 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; arrC.SetValue(i, (float)Math.Cos(i * INC));<br> 
&nbsp;&nbsp; &nbsp;}<br> 
<br> 
&nbsp;&nbsp; &nbsp;vtkPlotLine l_oPlot1 = (vtkPlotLine)chart.AddPlot((int)vtkChart.BAR_WrapperEnum.LINE);<br> 
&nbsp;&nbsp; &nbsp;l_oPlot1.SetInput(table, 0, 1);<br> 
&nbsp;&nbsp; &nbsp;l_oPlot1.SetColor(255, 0, 0, 255);<br> 
<br> 
&nbsp;&nbsp; &nbsp;vtkPlotLine l_oPlot2 = (vtkPlotLine)chart.AddPlot((int)vtkChart.BAR_WrapperEnum.LINE);<br> 
&nbsp;&nbsp; &nbsp;l_oPlot2.SetInput(table, 0, 2);<br> 
&nbsp;&nbsp; &nbsp;l_oPlot2.SetColor(0, 127, 127, 255);<br> 
<br> 
&nbsp;&nbsp; &nbsp;renwin.Render();<br> 
}</span><br><p style="margin:0px; padding:0px;"> 
        &nbsp;</p> 
<br> 
<span id="editor_signature"><span style="font-family: Verdana; font-size: 12px;">&nbsp;</span></span></span></span>
_______________________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">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">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">http://www.vtk.org/mailman/listinfo/vtkusers</a><br></blockquote></div><br></div></body></html>