Mouse Drag with keyboard input



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

    On 19/03/2005 at 15:33, xxxxxxxx wrote:

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

    ---------
    Hi,

    I am creating a ToolData plugin, and I would like to do a certain action when the mouse has moved, but while I press certain keys on the keyboard.

    My first idea was to create a MouseDrag routine in ToolData::MouseInput, but while the drag is in process, the ToolData::KeyboardInput method is not called. So I cannot recieve which key has been pressed.

    To combat this, I decided to transfer my code into ToolData::GetCursorInfo, and calculate the mouse position myself to simulate dragging.
    This worked fine until the mouse cursor left the viewport window, which stopped my plugin from performing what its suppsoed to do.

    Is there anyway I can retrieve keyboard input while a drag is in process?
    I can recieve the state of keys such as SHIFT, CTRL etc, by using

      
              BaseContainer keyResult;  
              GetInputState(BFM_INPUT_MOUSE,BFM_INPUT_MOUSELEFT,keyResult);  
              if ((keyResult.GetLong(BFM_INPUT_QUALIFIER) & QSHIFT) != 0)  
                   GePrint("Shift pressed");  
    

    But I'm looking to find out what keys A,B,C,D....etc has been pressed.

    Thanks



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

    On 19/03/2005 at 16:24, xxxxxxxx wrote:

    Solved

      
    GetInputState(BFM_INPUT_KEYBOARD, 'A', keyResult);  
    GePrint(LongToString(keyResult.GetData(BFM_INPUT_VALUE).GetLong()));  
    


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

    On 19/03/2005 at 16:34, xxxxxxxx wrote:

    Not quite solved

    It only works if the mouse actually moves. If I just hold the mouse button down, without moving the cursor, and press A. Then it won't work



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

    On 25/03/2005 at 12:57, xxxxxxxx wrote:

    What does your polling loop look like for the mouse drag and where did you add the GetInputState()?


Log in to reply