[vtkusers] vtkCommand doesnt exist in Java?

Gerrick Bivins gbivins at objectreservoir.com
Fri Aug 22 12:27:52 EDT 2008


The callback needs to be public rather than private.
Gerrick

On 8/22/08 11:27 AM, "Gökhan ERSOY" <goksoy66 at gmail.com> wrote:

> 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?
>  
> ------------------------------------------------------------------------------
> ----------------------------------
> public class SimpleTexture {
>     ...
>    public SimpleTexture() {
>        vtkRenderer ren = new vtkRenderer();
>        ...
>        vtkActor planeActor = new vtkActor();
>        ...
>        planeActor.AddObserver("LeftButtonPressEvent", this, "myCallBack");
>        ren.AddActor(planeActor);
>        ...
>    }
>    ...
>    private void myCallBack(){
>         System.out.println("Hello");
>    } 
>    ...
>    public static void main(String[] args) {
>         SimpleTexture simpleTexture = new SimpleTexture();
>    }
> }
> ------------------------------------------------------------------------------
> ----------------------------------
> 
> Thanks...
> 
> Gökhan
> 
> 
> 
> 2008/8/22 Gerrick Bivins <gbivins at objectreservoir.com>
>> 
>> Hi Gokhan,
>> For wrapped languages you need to use the AddObserver interface that takes
>> strings instead of  enums.
>> For example in java I use:
>>  abc->AddObserver("InteractionEvent",this,"myCallBack")
>> 
>> Where
>> InteractionEvent ==> event name to detect
>>  this==> class where callback function is defined (I think)
>>  myCallBack==> The name of the callback function/method
>> 
>> There's a chapter in the VTK users guide that goes into more detail.
>> Hope that helps.
>> Gerrick
>> 
>> 
>> 
>> On 8/22/08 10:46 AM, "Gökhan ERSOY" <goksoy66 at gmail.com> wrote:
>> 
>>> Hello,
>>> 
>>> vtkCommand class doesnt exist in Java? I am trying to call
>>> 
>>> abc->AddObserver(vtkCommand::InteractionEvent, myCallBack)
>>> 
>>> but i cant find vtkCommand class.
>>> 
>>> 
>>> 
>>> Gökhan
>>> 
>>> 
>>> _______________________________________________
>>> This is the private VTK discussion list.
>>> Please keep messages on-topic. Check the FAQ at:
>>> http://www.vtk.org/Wiki/VTK_FAQ
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>> 
>>> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080822/09c8a44f/attachment.htm>


More information about the vtkusers mailing list