[vtkusers] who 'observes' event?

A J lost_bits1110 at hotmail.com
Wed Jun 2 12:22:11 EDT 2004


Thanks Amy for your patience,

I guess my final question then is how do I go about making my own event 
loop.. Are there any examples of this? In the vtkXRenderWindowInteractor 
theres the following in the Start() method:

do
    {
    XEvent event;
    XtAppNextEvent(vtkXRenderWindowInteractor::App, &event);
    XtDispatchEvent(&event);
    }
  while (this->BreakLoopFlag == 0);

Is this something like what I'm supposed to replace the loop I posted 
earlier with?
I'm just not familiar with XEvent and XtAppNextEvent and XtDispatchEvent, 
which libraries do they come from and is this somethign like what I should 
use?

=S

thank you in advance...




>The problem is that there has to be an event loop for events to be 
>processed.  You either have to use iren->Start() or write your own event 
>loop. The problem is not in the interactor style; events are sent to the 
>interactor style from the render window interactor.  From 
>vtkRenderWindowInteractor.h:
>
>// vtkRenderWindowInteractor provides a platform-independent interaction
>// mechanism for mouse/key/time events. It serves as a base class for
>// platform-dependent implementations that handle routing of 
>mouse/key/timer
>// messages to vtkInteractorStyle and its subclasses.
>// vtkRenderWindowInteractor also provides controls for picking,
>// rendering frame rate, and headlights.
>
>- Amy
>
>At 11:52 AM 6/2/2004, you wrote:
>>So I guess this is the problem then..? How do I get around this? Now am I 
>>supposed to make my own InteractorStyle?  Or is there a simpler way to go 
>>about this..?
>>
>>Below is the structure of my code (I am just switching between two scenes, 
>>the "AnImportantFunction()" updates/modifies data in one renderer, and the 
>>"AnotherImportantFunction" modifies data in the ohter renderer)
>>
>>
>>CallbackCommand->SetCallback( MyClass::DoStuff(0 );
>>Iren->AddObserver( vtkCommand::KeyPressEvent, CallbackCommand );
>>
>>int sample = 0;
>>while(1)
>>{
>>
>>         if ( Flag == 0 )
>>         {
>>                 AnImportantFunction(  sample );
>>                 Iren->Render();
>>                 sample++;
>>         }
>>         else
>>         {
>>                AnotherImportantFunction(  sample );
>>                 sample++;
>>                 Iren->Render();
>>
>>         }
>>
>>}
>>
>>
>>
>>void MyClass::DoStuff( vtkObject* caller, unsigned long eid, void* 
>>clientdata, void* calldata)
>>{
>>
>>        cout<<Flag <<endl;
>>
>>         Flag = !Flag;
>>
>>
>>return;
>>}
>>
>>_________________________________________________________________
>>Get fast, reliable Internet access with MSN 9 Dial-up ­ now 3 months FREE! 
>>http://join.msn.click-url.com/go/onm00200361ave/direct/01/
>
>
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers

_________________________________________________________________
Getting married? Find great tips, tools and the latest trends at MSN Life 
Events. http://lifeevents.msn.com/category.aspx?cid=married




More information about the vtkusers mailing list