Dear Michael, the constants are listed in the file mitkInteractionConst.h located in mitk/Core/Code/Interactions. There you will find a list of actions; one of them is AcNEWPOINT = 80. So you can rather use the constants to specify which method shall be called when an action is sent to the object.
See http://www.mitk.org/wiki/Interaction_concept for an introduction on the interaction mechanism and also see tutorial step 10 as an example on how to implement a new interactor (documentation currently down, will be up in a little while). For the event listening you will have to adapt the state machine pattern of your interactor (/ listener). The pattern is connected to the listener via a parameter (name of the pattern in statemachine.xml) on instanciation of a statemachine object. You will have to take a different pattern or adapt the pattern to also wait for an Esc-Key event (EIDESCAPE = 14; see statemachine.xml and mitkInteractionConst.h). Inserting the followint lines into the state the state machine is currently in will be enough: <transition NAME="OnEscape" EVENT_ID="14" NEXT_STATE_ID="0"> <action ID="48008" /> <!-- AcCancel --> </transition> Adapt NEXT_STATE_ID to e.g. stay in the same. Then you can connect a method in the way you previously described (use AcCancel then) and the method will be called on ESC key press. Best regards, Ingmar -----Ursprüngliche Nachricht----- Von: Michael Emmersberger [mailto:[email protected]] Gesendet: Mittwoch, 15. Dezember 2010 15:51 An: [email protected] Betreff: [mitk-users] Receiving KeyEvents in an external tool Dear all, I have extended a plugin with an external tool. Now I would like to process key events within the tool. E.g. to interrupt an long running algorithm with Esc. I realized that I can add a listener with: mitk::GlobalInteraction::GetInstance()->AddListener(this); and catch a mouse press event with CONNECT_ACTION(80, MyEventProcessing); where 80 corresponds to the action AcNEWPOINT But so far I could not find any action to receive a keyboard event. I'm not quite sure how to proceed or if there is another way implemented that I was not able to figure out. Best regards, Michael ------------------------------------------------------------------------------ Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d _______________________________________________ mitk-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mitk-users ------------------------------------------------------------------------------ Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d _______________________________________________ mitk-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mitk-users
