<HTML>
<HEAD>
<TITLE>Re: [vtkusers] vtkCommand doesnt exist in Java?</TITLE>
</HEAD>
<BODY>
<FONT SIZE="4"><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
The callback needs to be public rather than private.<BR>
Gerrick<BR>
<BR>
On 8/22/08 11:27 AM, &quot;G&ouml;khan ERSOY&quot; &lt;goksoy66@gmail.com&gt; wrote:<BR>
<BR>
</SPAN></FONT></FONT><BLOCKQUOTE><FONT SIZE="4"><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>here is a part of my code. when i write the name of callback function myCallBack as &quot;myCallBack&quot; in parameter list of AddObserver, it is not recognized. does anyone have an idea? or is there any faulty statement?<BR>
&nbsp;<BR>
----------------------------------------------------------------------------------------------------------------<BR>
public class SimpleTexture {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;...<BR>
&nbsp;&nbsp;&nbsp;public SimpleTexture() {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vtkRenderer ren = new vtkRenderer();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vtkActor planeActor = new vtkActor();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;planeActor.AddObserver(&quot;LeftButtonPressEvent&quot;, this, &quot;myCallBack&quot;);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ren.AddActor(planeActor);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<BR>
&nbsp;&nbsp;&nbsp;}<BR>
&nbsp;&nbsp;&nbsp;...<BR>
&nbsp;&nbsp;&nbsp;private void myCallBack(){<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(&quot;Hello&quot;);<BR>
&nbsp;&nbsp;&nbsp;} <BR>
&nbsp;&nbsp;&nbsp;...<BR>
&nbsp;&nbsp;&nbsp;public static void main(String[] args) {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SimpleTexture simpleTexture = new SimpleTexture();<BR>
&nbsp;&nbsp;&nbsp;}<BR>
}<BR>
----------------------------------------------------------------------------------------------------------------<BR>
<BR>
Thanks...<BR>
<BR>
G&ouml;khan<BR>
<BR>
<BR>
<BR>
2008/8/22 Gerrick Bivins &lt;gbivins@objectreservoir.com&gt;<BR>
</SPAN></FONT></FONT><BLOCKQUOTE><FONT SIZE="4"><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
Hi Gokhan,<BR>
For wrapped languages you need to use the AddObserver interface that takes strings instead of &nbsp;enums.<BR>
For example in java I use:<BR>
&nbsp;abc-&gt;AddObserver(&quot;InteractionEvent&quot;,this,&quot;myCallBack&quot;)<BR>
<BR>
Where<BR>
InteractionEvent ==&gt; event name to detect<BR>
&nbsp;this==&gt; class where callback function is defined (I think)<BR>
&nbsp;myCallBack==&gt; The name of the callback function/method<BR>
<BR>
There's a chapter in the VTK users guide that goes into more detail.<BR>
Hope that helps.<BR>
Gerrick<BR>
<BR>
<BR>
<BR>
On 8/22/08 10:46 AM, &quot;G&ouml;khan ERSOY&quot; &lt;goksoy66@gmail.com&gt; wrote:<BR>
<BR>
</SPAN></FONT></FONT><BLOCKQUOTE><FONT SIZE="4"><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Hello,<BR>
<BR>
vtkCommand class doesnt exist in Java? I am trying to call <BR>
<BR>
abc-&gt;AddObserver(<B>vtkCommand::InteractionEvent</B>, myCallBack)<BR>
<BR>
but i cant find vtkCommand class.<BR>
<BR>
<BR>
<BR>
G&ouml;khan<BR>
<BR>
<HR ALIGN=CENTER SIZE="3" WIDTH="95%"></SPAN></FONT><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:10pt'>_______________________________________________<BR>
This is the private VTK discussion list.<BR>
Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a><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>
</SPAN></FONT></FONT></BLOCKQUOTE><FONT SIZE="4"><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
<BR>
</SPAN></FONT></FONT></BLOCKQUOTE></BLOCKQUOTE>
</BODY>
</HTML>