Middle Mouse Wheel



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/01/2011 at 03:29, xxxxxxxx wrote:

    Hey Jack,

    Here's the whole MouseInput() function.

      
    ool ZoomToCursor::MouseInput(BaseDocument *doc, BaseContainer &data, BaseDraw *bd, EditorWindow *win, const BaseContainer &msg)  
    {  
      BaseContainer state;  
      Real mx = msg.GetReal(BFM_INPUT_X);  
      Real my = msg.GetReal(BFM_INPUT_Y);  
      
      LONG button;  
        
      switch (msg.GetLong(BFM_INPUT_CHANNEL))  
      {  
          case BFM_INPUT_MOUSELEFT : button=KEY_MLEFT; break;  
          case BFM_INPUT_MOUSERIGHT: button=KEY_MRIGHT; break;  
          default: return TRUE;  
      }  
      
      if(GetInputState(BFM_INPUT_MOUSE, BFM_INPUT_MOUSEWHEEL, data)){  
            
          BaseContainer bc = BaseContainer();  
          win->BfGetInputEvent(BFM_INPUT_MOUSE,&bc);  
          if (msg.GetLong(BFM_INPUT_CHANNEL)==BFM_INPUT_MOUSEWHEEL)  
          {  
              GePrint("The Wheel is Spinning");  
          }  
      }  
      
      return TRUE;  
    }  
      
    

    This is a tool plugin that I want to identify if the mousewheel is turning.  If it is, I want some code to be initiated.  This is really the only thing I have with this particular plugin at the moment because it all hinges on reading if the mouse wheel is turning.   I just added the :

    if(GetInputState(BFM_INPUT_MOUSE, BFM_INPUT_MOUSEWHEEL, data)){

    and it still doesn't print the text to the console.   Did I use the wrong device and channel constants for GetInputState() ?

    I am also wondering if I am using the wrong basecontainer for storing the data.

    ~Shawn



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/01/2011 at 05:35, xxxxxxxx wrote:

    I can't get it to work either. I will try to find a solution.

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/01/2011 at 07:54, xxxxxxxx wrote:

    Do you know how GetInputState() determines if the input device is active?  That might offer some more insight as to why this isn't working. 
     
    ~Shawn



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 24/01/2011 at 10:06, xxxxxxxx wrote:

    Any luck with this? 
     
    Thanks,
     
    ~Shawn



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 24/01/2011 at 14:08, xxxxxxxx wrote:

    Howdy,

    Is it possible that the mouse wheel action is intercepted somewhere else when the mouse is in the viewport to control zooming the view and can't be access for anything else? I think that's the case with the right mouse button, too isn't it, to bring up a menu?

    Adios,
    Cactus Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 24/01/2011 at 15:32, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Real dx, dy;
      BaseContainer device;

    win->MouseDragStart(button,mx,my,MOUSEDRAGFLAGS_DONTHIDEMOUSE|MOUSEDRAGFLAGS_NOMOVE);
      while (win->MouseDrag(&dx,&dy,&device)==MOUSEDRAGRESULT_CONTINUE)
      {
          BaseContainer bc = BaseContainer();
          win->BfGetInputEvent(BFM_INPUT_MOUSE,&bc);
          if (msg.GetLong(BFM_INPUT_CHANNEL)==BFM_INPUT_MOUSEMIDDLE)
          {
              GePrint("The Wheel is Spinning");
          }
      }

    hmm, you did try

    if ( bc.GetLong(BFM_INPUT_CHANNEL)==BFM_INPUT_MOUSEWHEEL)

    instead of msg.GetLong... right?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 24/01/2011 at 16:51, xxxxxxxx wrote:

    Yeah,  still nothing.  I'm wondering if Cactus Dan is right about this one.  :)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 24/01/2011 at 17:43, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Howdy,

    Is it possible that the mouse wheel action is intercepted somewhere else when the mouse is in the viewport to control zooming the view and can't be access for anything else? I think that's the case with the right mouse button, too isn't it, to bring up a menu?

    Adios,
    Cactus Dan

    The left mouse button must be clicked when using the wheel, just as it is necessary in the c4d live selection tool. The wheel alone will of course not work! I thought that was clear in the first place. So yes, that might be the issue then?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 25/01/2011 at 02:06, xxxxxxxx wrote:

    Samir's code is how to do it. It's not possible to react on scroll wheel actions alone. You need to to hold left click.

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 25/01/2011 at 09:13, xxxxxxxx wrote:

    I was wondering how well this mouse wheel thing works for you guys. Because it's very Erratic on my system: Vista x64.

    The Liquid Tool example in the SDK has this same mouse wheel code in it to display the radius setting when the middle mouse wheel is spun. Plus I also added the line GePrint("Scrolling"); to it just as a test.

    Although it works. It's very hit and miss.
    Sometimes the wheel spins several times before C4D catches it and then prints the results to the console. And other times It catches it almost immediately when the wheel is spun.
    So I was wondering if this is a known limitation. Or a problem with my system?

    -ScottA



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 25/01/2011 at 10:16, xxxxxxxx wrote:

    I will take a look at the Liquid Tool example when I get home and see if I can get it to work right.  I suppose that if that's the only way to get it to work then it will have to do.  :)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 27/07/2011 at 21:24, xxxxxxxx wrote:

    Okay so I am trying to accomplish this again but with the right mouse button.  I was never able to get it to work fluidly with the middle mouse button either.  The problem is that when you hold down the left mouse button and then either roll the mouse wheel or click the right mouse button, depending on the code implementation, it responds very sporadically,  In the code posted below, I try to hold the left mouse button and then click the right mouse button and I need to click many different times and move the mouse around a lot in order to get it to run once..   Does anyone see any reason why this would be happening?  Am I leaving out some sort up update that causes this to function properly?

    Here's the code I have:

      
      
      Real dx, dy;  
      BaseContainer device;  
      
      win->MouseDragStart(button,mx,my,MOUSEDRAGFLAGS_DONTHIDEMOUSE|MOUSEDRAGFLAGS_NOMOVE);  
      while (win->MouseDrag(&dx,&dy,&device)==MOUSEDRAGRESULT_CONTINUE)  
      {  
          if(dx == 0 && dy == 0) continue;  
            
          BaseContainer bc = BaseContainer();  
          win->BfGetInputEvent(BFM_INPUT_MOUSE, &bc);  
          if (bc.GetLong(BFM_INPUT_CHANNEL) == BFM_INPUT_MOUSERIGHT)  
          {  
              GePrint("RIGHT BUTTON PRESSED");  
          }  
      }  
      
      if (win->MouseDragEnd()==MOUSEDRAGRESULT_ESCAPE)  
      {  
      }   
      
    

    Thanks in advance.

    Shawn



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 29/07/2011 at 10:18, xxxxxxxx wrote:

    Any thoughts?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 31/07/2011 at 09:00, xxxxxxxx wrote:

    Okay.  I figured this out.  :)  I wanted to share my results with others as it may come in handy for you as well.  :)

    Here's the code I used to get it to work every time I click the second button.

      
    win->MouseDragStart(button,mx,my,MOUSEDRAGFLAGS_DONTHIDEMOUSE|MOUSEDRAGFLAGS_NOMOVE);  
      while (win->MouseDrag(&dx,&dy,&device)==MOUSEDRAGRESULT_CONTINUE)  
      {  
          if(dx == 0 && dy == 0)  
          {  
              GeSyncMessage(EVMSG_ASYNCEDITORMOVE);  
              BaseContainer bc = BaseContainer();  
                
              win->BfGetInputEvent(BFM_INPUT_MOUSE, &bc);  
              if (bc.GetLong(BFM_INPUT_CHANNEL) == BFM_INPUT_MOUSERIGHT)  
              {  
                  GePrint("RIGHT BUTTON PRESSED");  
              }  
          }  
      }  
    

    I noticed that when I placed a GePrint() within the MouseDrag() loop that it would work perfectly. 
    This then led me to place this line:

      
    GeSyncMessage(EVMSG_ASYNCEDITORMOVE);  
    

    in to the code.  and with that little addition it works great..  This works also with the middle mouse wheel..    Just replace

    BFM_INPUT_MOUSERIGHT  
    with  
    BFM_INPUT_MOUSEWHEEL  
    

    Remember of course that this all works only if you are holding down the left mouse button.  :)

    Hope this is helpful for someone.  :)

    Thanks,

    Shawn


Log in to reply