<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
Well, I dont know the class you are using but here there are some tips
that can help you developing with BCB:<br>
Usually <font size="2">this-&gt;Array[id] = i;&nbsp; means that Array
should be allocated to store at least number id items.<br>
I mean that may be your code tries to assign a value (i) in a
non-existing item of the array(Array[id]).<br>
TCL runtimes are different and it can be that they allocate more memory
than real needed (like visual basic does) and the exception is never
raised even the program is wrong.<br>
<br>
Another good reason to use BCB is that you can check your code with
Codeguard built-in tool.<br>
What is codeguard? It checks memory leaks and wrong memory accesses.<br>
When an exception is raised </font><font size="2">(example </font><font
 size="2">Access violation at the address) </font><font size="2">it
shows you </font><font size="2">where and why it happened.<br>
<br>
</font><font size="2">Try to activate it using Project-&gt;Options menu
in the Codeguard tag.<br>
<br>
Greeting,<br>
Luca<br>
<br>
</font><font size="2"></font>PS: never mind about memory leaks it
detects while exiting from a VTK project: the vtkBorlandRenderWindow
component have to be revisioned.<br>
<br>
Xianjin Yang wrote:
<blockquote
 cite="mid6AC51773FA304E469DEE9569AF903E5B948573@mail.exchngsvr.agiusa.com"
 type="cite">
  <meta http-equiv="Content-Type" content="text/html; ">
  <meta name="Generator"
 content="MS Exchange Server version 5.5.2653.12">
  <title>[vtkusers] Problem with VTK4.4 + BCB6 + WinXP Pro</title>
  <p><font size="2">Hi Dean,</font>
  </p>
  <p><font size="2">To demo the problem with VTK4.4 + BCB6, I created a
small demo out of
VTK\Examples\GUI\Win32\vtkBorland\ProjectDemo\Project_vtkDemo&nbsp; and&nbsp;
/VTK/Examples/DataManipulation/Cxx/Arrays.cxx. I simply replaced the
the button event handler with Arrays.cxx.</font></p>
  <p><font size="2">When my demo program calls
vtkCellArray-&gt;InsertNextCell(4), I got an Excess Violation. BCB
error message says</font>
  <br>
  <font size="2">"Access violation at the address 0040263F in module
Project_vtkDemo.exe. Write of address 00000000." The BCB debugger
pointed to the error code in VTK below:</font></p>
  <p><font size="2">inline void vtkIdTypeArray::InsertValue(vtkIdType
id, vtkIdType i)</font>
  <br>
  <font size="2">{</font>
  <br>
  <font size="2">&nbsp; if ( id &gt;= this-&gt;Size )</font>
  <br>
  <font size="2">&nbsp;&nbsp;&nbsp; {</font>
  <br>
  <font size="2">&nbsp;&nbsp;&nbsp; this-&gt;ResizeAndExtend(id+1);</font>
  <br>
  <font size="2">&nbsp;&nbsp;&nbsp; }</font>
  <br>
  <font size="2">&nbsp; this-&gt;Array[id] = i;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;------------ Error code inside VTK</font>
  <br>
  <font size="2">&nbsp; if ( id &gt; this-&gt;MaxId )</font>
  <br>
  <font size="2">&nbsp;&nbsp;&nbsp; {</font>
  <br>
  <font size="2">&nbsp;&nbsp;&nbsp; this-&gt;MaxId = id;</font>
  <br>
  <font size="2">&nbsp;&nbsp;&nbsp; }</font>
  <br>
  <font size="2">} </font>
  </p>
  <p><font size="2">FYI, I had no problem to run the TCL version of the
same code /VTK/Examples/DataManipulation/TCL/Arrays.tcl under VTK4.4.</font></p>
  <p><font size="2">Thank you for your time.</font>
  </p>
  <p><font size="2">Yang</font>
  </p>
  <br>
  <br>
  <p><font size="2">----------- My Demo Code Below -----------</font>
  </p>
  <p><font size="2">void __fastcall TVTK_Form::bc1Click(TObject *Sender)</font>
  <br>
  <font size="2">{</font>
  <br>
  <font size="2">&nbsp; vtkFloatArray* pcoords = vtkFloatArray::New();</font>
  <br>
  <font size="2">&nbsp; pcoords-&gt;SetNumberOfComponents(3);</font>
  <br>
  <font size="2">&nbsp; pcoords-&gt;SetNumberOfTuples(4);</font>
  <br>
  <font size="2">&nbsp; float pts[4][3] = { {0.0, 0.0, 0.0}, {0.0, 1.0, 0.0},</font>
  <br>
  <font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {1.0, 0.0, 0.0}, {1.0, 1.0, 0.0}
};</font>
  <br>
  <font size="2">&nbsp; for (int i=0; i&lt;4; i++) pcoords-&gt;SetTuple(i,
pts[i]);</font>
  </p>
  <p><font size="2">&nbsp; vtkPoints* points = vtkPoints::New();</font>
  <br>
  <font size="2">&nbsp; points-&gt;SetData(pcoords);</font>
  </p>
  <p><font size="2">&nbsp; vtkCellArray* strips = vtkCellArray::New();</font>
  </p>
  <p><font size="2">&nbsp; strips-&gt;InsertNextCell(4);&nbsp;&nbsp;&nbsp;
&lt;------------------ Caused Access Violation</font>
  </p>
  <p><font size="2">&nbsp; strips-&gt;InsertCellPoint(0);</font>
  <br>
  <font size="2">&nbsp; strips-&gt;InsertCellPoint(1);</font>
  <br>
  <font size="2">&nbsp; strips-&gt;InsertCellPoint(2);</font>
  <br>
  <font size="2">&nbsp; strips-&gt;InsertCellPoint(3);</font>
  </p>
  <p><font size="2">&nbsp; vtkIntArray* temperature = vtkIntArray::New();</font>
  <br>
  <font size="2">&nbsp; temperature-&gt;SetName("Temperature");</font>
  <br>
  <font size="2">&nbsp; temperature-&gt;InsertNextValue(10);</font>
  <br>
  <font size="2">&nbsp; temperature-&gt;InsertNextValue(20);</font>
  <br>
  <font size="2">&nbsp; temperature-&gt;InsertNextValue(30);</font>
  <br>
  <font size="2">&nbsp; temperature-&gt;InsertNextValue(40);</font>
  </p>
  <p><font size="2">&nbsp; vtkDoubleArray* vorticity = vtkDoubleArray::New();</font>
  <br>
  <font size="2">&nbsp; vorticity-&gt;SetName("Vorticity");</font>
  <br>
  <font size="2">&nbsp; vorticity-&gt;InsertNextValue(2.7);</font>
  <br>
  <font size="2">&nbsp; vorticity-&gt;InsertNextValue(4.1);</font>
  <br>
  <font size="2">&nbsp; vorticity-&gt;InsertNextValue(5.3);</font>
  <br>
  <font size="2">&nbsp; vorticity-&gt;InsertNextValue(3.4);</font>
  </p>
  <p><font size="2">&nbsp; vtkPolyData* polydata = vtkPolyData::New();</font>
  <br>
  <font size="2">&nbsp; polydata-&gt;SetPoints(points);</font>
  <br>
  <font size="2">&nbsp; polydata-&gt;SetStrips(strips);</font>
  <br>
  <font size="2">&nbsp;
polydata-&gt;GetPointData()-&gt;SetScalars(temperature);</font>
  <br>
  <font size="2">&nbsp; polydata-&gt;GetPointData()-&gt;AddArray(vorticity);</font>
  <br>
  <font size="2">&nbsp; vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();</font>
  <br>
  <font size="2">&nbsp; mapper-&gt;SetInput(polydata);</font>
  <br>
  <font size="2">&nbsp; mapper-&gt;SetScalarRange(0, 40);</font>
  </p>
  <p><font size="2">&nbsp; vtkActor* actor = vtkActor::New();</font>
  <br>
  <font size="2">&nbsp; actor-&gt;SetMapper(mapper);</font>
  <br>
  <font size="2">&nbsp; vtkWindow1-&gt;GetRenderer()-&gt;AddActor(actor);</font>
  </p>
  <p><font size="2">&nbsp; pcoords-&gt;Delete();</font>
  <br>
  <font size="2">&nbsp; points-&gt;Delete();</font>
  <br>
  <font size="2">&nbsp; strips-&gt;Delete();</font>
  <br>
  <font size="2">&nbsp; temperature-&gt;Delete();</font>
  <br>
  <font size="2">&nbsp; vorticity-&gt;Delete();</font>
  <br>
  <font size="2">&nbsp; polydata-&gt;Delete();</font>
  <br>
  <font size="2">&nbsp; mapper-&gt;Delete();</font>
  <br>
  <font size="2">&nbsp; actor-&gt;Delete();</font>
  </p>
  <p><font size="2">&nbsp; vtkWindow1-&gt;GetRenderer()-&gt;ResetCamera();</font>
  <br>
  <font size="2">&nbsp; vtkWindow1-&gt;Invalidate();</font>
  <br>
  <font size="2">}</font>
  </p>
  <br>
  <p><font size="2">-----Original Message-----</font>
  <br>
  <font size="2">From: Dean Inglis [<a
 href="mailto:dean.inglis@camris.ca">mailto:dean.inglis@camris.ca</a>] </font>
  <br>
  <font size="2">Sent: Monday, March 29, 2004 10:56 AM</font>
  <br>
  <font size="2">To: vtkusers archive</font>
  <br>
  <font size="2">Cc: <a class="moz-txt-link-abbreviated" href="mailto:Yang@AGIUSA.COM">Yang@AGIUSA.COM</a></font>
  <br>
  <font size="2">Subject: Re: [vtkusers] Display model coordinate with
vtkImagePlaneWidget</font>
  </p>
  <br>
  <p><font size="2">Hi Yang,</font>
  </p>
  <p><font size="2">&gt;continuous cursoring is found in vtk4.4 and up,
but I could not make my</font>
  <br>
  <font size="2">BCB6</font>
  <br>
  <font size="2">&gt;project to work with vtk4.4. I am still using
vtk4.2. This may be </font>
  <br>
  <font size="2">&gt;another sign to abandon BCB.</font>
  </p>
  <p><font size="2">that's odd.&nbsp; I have about 6 different active
projects that successfully compile and run error free both on BCB5 and
BCB6 with latest cvs VTK release (Intel Pentium 4 processors, Windows
2000 OS).&nbsp; What specific problems are you having?</font></p>
  <p><font size="2">Dean</font>
  </p>
  <br>
</blockquote>
</body>
</html>