[vtkusers] Blocking 'Q' and 'E' keys

Shakes Shekhar.Chandra at sci.monash.edu.au
Mon Feb 23 17:33:09 EST 2009


Hi Alan,

Not sure if this will do what u need. But when I needed to unbind the 
mouse click events I used

///Unbind the right mouse button events as Qt uses context menu. 
QVTKWidget::GetRenderWindow()->GetInteractor()->RemoveObservers(vtkCommand::RightButtonPressEvent); 

QVTKWidget::GetRenderWindow()->GetInteractor()->RemoveObservers(vtkCommand::RightButtonReleaseEvent);

Not sure how to unbind keys, perhaps change the 
vtkCommand::RightButtonPressEvent bits?

Hope that helps
Cheers
Shakes

amutka wrote:
> Dear Shash, thank you for your answer.
> I add event to interactor...
> 
> iren1->AddObserver(vtkCommand::ExitEvent,eventObserver,-5);
> 
> And I caught the ExitEvent in my eventObserver class. How can I abort event?
> I'm using simple class, structure like this
> 
>  void PickCommand::Execute(vtkObject *caller,unsigned long event,void *
> callData)
> {
>        
>         switch(event)
>         {
>             case vtkCommand::PickEvent:
>             {
>                         
>             }
>             case vtkCommand::ExitEvent
>             {
>          ....
>             }
>  }
> 
> and I make object from class
> 
> PickCommand * eventObserver = PickCommand::New();
> and I simply add observer
> 
> iren1->AddObserver(vtkCommand::ExitEvent,eventObserver,-5);
> 
> Pressing Q or E Exit event is invoked but how can I block ExitMethod. I
> tried to call
> vtkCommand::SetAbortEvent
> 
> but i think this is wrong, I need to block interactor events and I don't
> know how. I'm sorry for bothering, but I have no idea more, so please give
> me another hint!
> Thank you!
> 
> Alan
> 
> 
> Bugzilla from trshash84 at gmail.com wrote:
>> On Saturday 21 Feb 2009 5:54:14 pm Alan Mutka wrote:
>>> I have problems with blocking keys Q and E witch are shutting down
>>> visualization.
>>> I have tried adding Observers to keys, setting ExitMethod but without
>>> success.
>>> Please help if you had better luck and managed to find solution!
>>> Thank you!
>> Hi
>>
>> The way we worked this out was to add observers directly to the interactor 
>> (not the style), at a priority of -5, and then calling AbortEvent on the 
>> command whenever the event hits.
>>
>> HTH
>> Shash
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Shekhar_Chandra.vcf
Type: text/x-vcard
Size: 247 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090224/0944f764/attachment.vcf>


More information about the vtkusers mailing list