Handling Mouse Drag



  • On 19/05/2016 at 01:08, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R14 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hi Folks,

    I'm trying to create a drag feature that's similar to the viewport rectangle mouse drag (but in my own user area). The viewport rectangle drag doesn't seem to result in much CPU, but it also doesn't effect anything else in the interface if the mouse goes over something else.

    I can initiate a drag from my user area's InputEvent(), but if I drag the mouse outside of the dialog, the dialog no longer receives any messages. If I initiate a loop inside the InputEvent(), then I get a 100% CPU rate on one core.

    How is something like the viewport rectangle drag handled?

    WP.



  • On 19/05/2016 at 05:16, xxxxxxxx wrote:

    Hello,

    using MouseDrag() does not increase the CPU load that much during such a drag. What exactly are you doing?

      
    // start mouse drag  
    MouseDragStart(BFM_INPUT_MOUSELEFT, startX, startY, MOUSEDRAGFLAGS_DONTHIDEMOUSE);  
      
    while (MouseDrag(&deltaX, &deltaY, &channels) == MOUSEDRAGRESULT_CONTINUE)  
    {  
     if (!GetInputState(BFM_INPUT_MOUSE, BFM_INPUT_MOUSELEFT, state))  
         break;  
      
     if (state.GetInt32(BFM_INPUT_VALUE) == 0)  
         break;  
      
     // print something when the mouse has moved  
     if(deltaX != 0.0 || deltaY != 0.0)  
         GePrint("Mouse Drag");  
    }  
      
    MouseDragEnd();  
    

    Best wishes,
    Sebastian


Log in to reply