<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. </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>
const int NUM_POINTS = 100;<br>
const float INC = 7.5f / (NUM_POINTS - 1);<br>
<br>
vtkContextView view = vtkContextView.New();<br>
<br>
vtkRenderWindow renwin = renderWindowControl1.RenderWindow;<br>
<br>
renwin.RemoveRenderer(renwin.GetRenderers().GetFirstRenderer());<br>
renwin.AddRenderer(view.GetRenderer());<br>
<br>
renwin.GetInteractor().Disable();<br>
renwin.SetInteractor(view.GetInteractor());<br>
<br>
view.GetRenderer().SetBackground(1.0, 1.0, 1.0);<br>
<br>
vtkChartXY chart = vtkChartXY.New();<br>
chart.SetTitle("MyChart");<br>
chart.SetShowLegend(true);<br>
chart.GetAxis(0).SetTitle("Y");<br>
chart.GetAxis(1).SetTitle("X");<br>
<br>
view.GetScene().AddItem(chart);<br>
<br>
vtkTable table = vtkTable.New();<br>
<br>
vtkFloatArray arrX = vtkFloatArray.New();<br>
arrX.SetName("X");<br>
table.AddColumn(arrX);<br>
<br>
vtkFloatArray arrS = vtkFloatArray.New();<br>
arrS.SetName("Sine");<br>
table.AddColumn(arrS);<br>
<br>
vtkFloatArray arrC = vtkFloatArray.New();<br>
arrC.SetName("Cosine");<br>
table.AddColumn(arrC);<br>
<br>
table.SetNumberOfRows(NUM_POINTS);<br>
<br>
for (int i = 0; i < NUM_POINTS; i++)<br>
{<br>
arrX.SetValue(i, i * INC);<br>
arrS.SetValue(i, (float)Math.Sin(i * INC));<br>
arrC.SetValue(i, (float)Math.Cos(i * INC));<br>
}<br>
<br>
vtkPlotLine l_oPlot1 = (vtkPlotLine)chart.AddPlot((int)vtkChart.BAR_WrapperEnum.LINE);<br>
l_oPlot1.SetInput(table, 0, 1);<br>
l_oPlot1.SetColor(255, 0, 0, 255);<br>
<br>
vtkPlotLine l_oPlot2 = (vtkPlotLine)chart.AddPlot((int)vtkChart.BAR_WrapperEnum.LINE);<br>
l_oPlot2.SetInput(table, 0, 2);<br>
l_oPlot2.SetColor(0, 127, 127, 255);<br>
<br>
renwin.Render();<br>
}</span><br><p style="margin:0px; padding:0px;">
         </p>
<br>
<span id="editor_signature"><span style="font-family: Verdana; font-size: 12px;"> </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>