Hi Ingmar,
I recompiled MITK to enable debug message but:
-the messages are well displayed when you move from a state to another but not 
if you have a transition leading to the same state (it could be useful).
-to skip this problem I set the next state to "neutral" (ID=0) when an event 
occurs when in state "zoom" (ID=3) and if I look for the event "mouse move", 
"left mouse click + move" or "right mouse click + move" nothing happens when 
looking for keyboard press event works fine.
So is there a way to emit the mouse move event even if other mouse buttons are 
clicked ? Or how could I add a new event for the configuration "left + right 
mouse pressed and mouse move" ?
Thanks,
Julien
From: [email protected]
To: [email protected]; [email protected]
Date: Mon, 12 Sep 2011 17:33:09 +0200
Subject: AW: [mitk-users] Question to Events and the State machine in mitk



Hi Julien,seems correct from the first sight. Did you check  if the state 
machine traverses the right states? To activate debug console mode (many output 
messages in command line) by activating advanced option 
“MBILOG_ENABLE_DEBUG_MESSAGES”. This is the first step when debugging 
interaction patterns. This way you can pinpoint a state, where the state 
machine halters and see if the pattern definition is incorrect at that state.A 
trick to cause mouse button click instead of mouse move events in the 
application while breakpoints are set:MouseClick somewhere within the 
application but outside the renderwindows and hold the mouse button. Then into 
the widget, release mouse button, don’t move the mouse and then click the 
desired mouse button. This way you can debug a mouse click event rather than 
being hindered by mouse move events all the time!If you don’t succeed, send a 
patch and I will check.Good luck,Ingmar Von: Julien Le Pallec 
[mailto:[email protected]] 
Gesendet: Montag, 12. September 2011 17:09
An: Wegner, Ingmar; mitk users
Betreff: Re: [mitk-users] Question to Events and the State machine in mitk Hi 
Ingmar, Thanks for your early reply. In fact, the solution you described is 
exactly what I have done. Here you can see my state machine: <stateMachine 
NAME="ZoomAndPan">    <state NAME="neutral" ID="0" START_STATE="TRUE">      
<transition NAME="initmove" NEXT_STATE_ID="4" EVENT_ID="4">        <action 
ID="9" />      </transition>      <transition NAME="leftPress1" 
NEXT_STATE_ID="1" EVENT_ID="1"/>      <transition NAME="rightPress1" 
NEXT_STATE_ID="2" EVENT_ID="2"/>       </state>    <state NAME="buffer1" 
ID="1">      <transition NAME="rightPress2" NEXT_STATE_ID="3" EVENT_ID="2">     
   <action ID="1011"/>      </transition>      <transition NAME="leftRelease1" 
NEXT_STATE_ID="0" EVENT_ID="505"/>      <transition NAME="mouseMove1" 
NEXT_STATE_ID="0" EVENT_ID="530"/>    </state>    <state NAME="buffer2" ID="2"> 
     <transition NAME="leftPress2" NEXT_STATE_ID="3" EVENT_ID="1">        
<action ID="1011"/>      </transition>      <transition NAME="rightRelease1" 
NEXT_STATE_ID="0" EVENT_ID="507"/>      <transition NAME="mouseMove2" 
NEXT_STATE_ID="0" EVENT_ID="531"/>    </state>    <state NAME="zoom" ID="3">    
  <transition NAME="leftRelease2" NEXT_STATE_ID="2" EVENT_ID="505">        
<action ID="44"/>      </transition>      <transition NAME="rightRelease2" 
NEXT_STATE_ID="1" EVENT_ID="507">        <action ID="44"/>      </transition>   
   <transition NAME="doZoom" NEXT_STATE_ID="3" EVENT_ID="520">        <action 
ID="1012"/>      </transition>    </state>    <state NAME="move" ID="4">      
<transition NAME="move" NEXT_STATE_ID="4" EVENT_ID="533">        <action 
ID="92" />      </transition>      <transition NAME="finish" NEXT_STATE_ID="0" 
EVENT_ID="506">        <action ID="43" />      </transition>    </state>  
</stateMachine> But the problem is in the state "zoom" the transition "doZoom" 
is never reached. As I am using my own intereactor, I thought it could be the 
event handling so I derived the CanHandleEvent method and set it to 1 for 
mitk::Type_MouseMove but it does not change anything... I don´t know where to 
investigate... Regards, Julien > From: [email protected]
> To: [email protected]; [email protected]
> Date: Mon, 12 Sep 2011 16:22:27 +0200
> Subject: AW: [mitk-users] Question to Events and the State machine in mitk
> 
> Hi Julien,
> 
> the important code for this is located in mitkBaseRenderer.cpp.
> Here the following methods submitt the event from QT to MITK:
> 
> //## @brief Mouse event dispatchers
> virtual void MousePressEvent(MouseEvent*);
> 
> //## @brief Mouse event dispatchers
> virtual void MouseReleaseEvent(MouseEvent*);
> 
> //## @brief Mouse event dispatchers
> virtual void MouseMoveEvent(MouseEvent*);
> 
> //## @brief Wheel event dispatcher
> virtual void WheelEvent(mitk::WheelEvent* we);
> 
> //## @brief Key event dispatcher
> virtual void KeyPressEvent(KeyEvent*);
> 
> The question is if the method MouseMoveEvent(..) is called if the two buttons 
> are pressed.
> Quick Test: std::couts in above mentioned methods.
> Order of performed events: LeftMousePress, RightMousePress, MiddleMousePress, 
> MouseMove, LeftMouseRelease, RightMouseRelease, MiddleMouseRelease.
> Results are, that the above mentioned methods get called in following order: 
> MousePress, MousePress, MousePress, MouseMove, ... MouseMove, MouseRelease, 
> MouseRelease, MouseRelease
> 
> So the events are passed and you could do the following:
> 
> StartState1
> Stay in state1 on MouseRelease
> Going from state 1 to 2 if rightMousePress
> State2
> Going from state2 to 3 if leftMousePress 
> Going from state2 to 1 if MouseRelease
> State3
> Staying in state3 on MouseMove and performing desired Action
> Going from state3 to 1 if MouseRelease
> 
> This way the user has to press rightMouseButton first and the 
> leftMouseButton. If both buttons shall be pressed at once, you will have to 
> represent both combinations (starting left, then right and starting right and 
> then left; both directions leading to state 3). QT will fire two separate 
> events no matter how synchronous you press the two buttons. (You will also 
> have to take care for left- and rightMouseButton seperately.)
> 
> Even though I haven't tested it, this should work nicely.
> 
> Best regards,
> Ingmar
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: Julien Le Pallec [mailto:[email protected]] 
> Gesendet: Montag, 12. September 2011 12:05
> An: [email protected]
> Betreff: Re: [mitk-users] Question to Events and the State machine in mitk
> 
> Hi,
> 
> I am actually working on something similar (do an action when both mouse 
> buttons 
> are pressed and the mouse moves) and had the same idea of "buffer" states to 
> reach the final state where I want the action emmitted.
> 
> The problem is that when I reach the state where both buttons are clicked, 
> the 
> transition occuring when the mouse moves (I also tried Left/Right click + 
> Move) 
> is never called. It seems that the association of left + right mouse buttons 
> pressed blocks the emmission of events like mouse move etc..
> 
> So, my question is: Is there any way for me to implement new events based on 
> both buttons pressed ? 
> 
> Thanks for your help,
> 
> Julien
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> Doing More with Less: The Next Generation Virtual Desktop 
> What are the key obstacles that have prevented many mid-market businesses
> from deploying virtual desktops? How do next-generation virtual desktops
> provide companies an easier-to-deploy, easier-to-manage and more affordable
> virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
> _______________________________________________
> mitk-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mitk-users
> 
> 
> Wegner Ingmar <I.Wegner@...> writes:
> 
> > 
> > Hi Christian,
> > 1. you are right, you shouldn't have to change the core. Lately I have been 
> working on an extension towards
> > the state machine mechanism.
> > >From Revision #27351 on you have the possibility to load user specified 
> > >xml 
> files containing state
> > machine patterns.
> > For an example on how to use it see mitkStateMachineFactoryTest.
> > 
> > 2. That's a little more tricky: Since the operating system doesn't send 
> > events 
> "Space-pressed and
> > Mouse-moved" you will have to implement it yourself. E.g. define a pattern 
> that goes from one state to the
> > next in case space is pressed. Then listen for mouse move events. Then 
> > leave 
> the state once space is
> > released. By the way, it is much easier if you use a modifier key 
> (Shift/Strg/Alt/Meta etc). This way you
> > can catch the event "Modifier-key and Mouse-moved". Each "regular" key 
> > submits 
> an event on its own while
> > modifier keys add their state to events caused by regular keys.
> > 
> > Best Regards,
> > Ingmar
> > 
> > 
> > -----Ursprüngliche Nachricht-----
> > Von: Wilhelm, Christian
> > [mailto:Christian.Wilhelm@...] 
> > Gesendet: Montag, 24. Januar 2011 18:21
> > An: 'mitk-users@...'
> > Betreff: [mitk-users] Question to Events and the State machine in mitk
> > 
> > Dear Sir or Madam,
> > 
> > I am writing a plug-in for the Ext-App. Usually you should never change the 
> core of the main project for your
> > plug-in. That's why I want to know if there is another way to interact with 
> the ExtApp next to adding
> > statemachines in the xml.
> > 
> > My second question is about the state machine. I want to use the mousemove 
> event while i am pressing a button (
> > for example the space button or the "m" button). For this I need to add the 
> Buttonstate of this button into
> > the move mouse event definition, am I? Where I get the information which 
> button effects in which
> > buttonstate? Maybe I have to add the buttonstate of buttons, which are 
> > unused 
> at the momant, by my self, but
> > what I have to do for this?
> > 
> > Thanks for your help. Christian Wilhelm
> > ______________________________________________________________
> > Christian Wilhelm
> > SHK
> > Innovation Center Computer Assisted Surgery (ICCAS)
> > Semmelweisstraße 14
> > D -- 04103 Leipzig
> > Germany
> > christian.wilhelm@... 
> > 
> > ------------------------------------------------------------------------------
> > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
> > Finally, a world-class log management solution at an even better price-free!
> > Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
> > February 28th, so secure your free ArcSight Logger TODAY! 
> > http://p.sf.net/sfu/arcsight-sfd2d
> > _______________________________________________
> > mitk-users mailing list
> > mitk-users@...
> > https://lists.sourceforge.net/lists/listinfo/mitk-users
> > 
> > ------------------------------------------------------------------------------
> > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
> > Finally, a world-class log management solution at an even better price-free!
> > Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
> > February 28th, so secure your free ArcSight Logger TODAY! 
> > http://p.sf.net/sfu/arcsight-sfd2d
> >                                       
------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
Learn about the latest advances in developing for the 
BlackBerry&reg; mobile platform with sessions, labs & more.
See new tools and technologies. Register for BlackBerry&reg; DevCon today!
http://p.sf.net/sfu/rim-devcon-copy1 
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to