[vtkusers] vtkCommand doesnt exist in Java?

Gökhan ERSOY goksoy66 at gmail.com
Sat Aug 23 10:15:48 EDT 2008


i found the solution. i should apply observer to interactor, not to actor.
:) thats it.

Gökhan



2008/8/22 Gökhan ERSOY <goksoy66 at gmail.com>

> ok, the problem was "private". :) now callback function is recognized. but
> now, it doesn't work. :) i am pressing LeftButton of mouse, but there is no
> result.
>
>
> Gökhan
>
>
> 2008/8/22 Gerrick Bivins <gbivins at objectreservoir.com>
>
>>
>> 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/20080823/a83e5a8c/attachment.htm>


More information about the vtkusers mailing list