<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, "Gökhan ERSOY" <goksoy66@gmail.com> 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 "myCallBack" in parameter list of AddObserver, it is not recognized. does anyone have an idea? or is there any faulty statement?<BR>
<BR>
----------------------------------------------------------------------------------------------------------------<BR>
public class SimpleTexture {<BR>
...<BR>
public SimpleTexture() {<BR>
vtkRenderer ren = new vtkRenderer();<BR>
...<BR>
vtkActor planeActor = new vtkActor();<BR>
...<BR>
planeActor.AddObserver("LeftButtonPressEvent", this, "myCallBack");<BR>
ren.AddActor(planeActor);<BR>
...<BR>
}<BR>
...<BR>
private void myCallBack(){<BR>
System.out.println("Hello");<BR>
} <BR>
...<BR>
public static void main(String[] args) {<BR>
SimpleTexture simpleTexture = new SimpleTexture();<BR>
}<BR>
}<BR>
----------------------------------------------------------------------------------------------------------------<BR>
<BR>
Thanks...<BR>
<BR>
Gökhan<BR>
<BR>
<BR>
<BR>
2008/8/22 Gerrick Bivins <gbivins@objectreservoir.com><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 enums.<BR>
For example in java I use:<BR>
abc->AddObserver("InteractionEvent",this,"myCallBack")<BR>
<BR>
Where<BR>
InteractionEvent ==> event name to detect<BR>
this==> class where callback function is defined (I think)<BR>
myCallBack==> 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, "Gökhan ERSOY" <goksoy66@gmail.com> 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->AddObserver(<B>vtkCommand::InteractionEvent</B>, myCallBack)<BR>
<BR>
but i cant find vtkCommand class.<BR>
<BR>
<BR>
<BR>
Gö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>