Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Handling Mouse Drag

    SDK Help
    0
    2
    241
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • First post
          Last post